UECIDE

|juˈekaɪdiːˈiː| :: Wake Up Your Arduino
Last edit: 2020-10-30 by matt

Variable Commands


Variable commands are a method whereby active commands can be embedded within a string and expanded as if they were variables. They form a core part of the magic and flexibility of UECIDE.

arduino

  • ${arduino:file,key}

Load an Ardiuno-format configuration file and extract the value for the provided key.

basename

  • ${basename:filepath[,extension])

Retrieve just the filename portion of a file path, optionally removing the extension if it matches. For example:

${basename:/home/foo/.uecide/cores/chipkit/core.txt,txt}
=> core

board

  • ${board:[name,]key}

Retrieve the value for a key from the current board, or from a specific board if the name is provided.

char

  • ${char:number}

Convert a numeric value into the associated ASCII character. The number can be in either decimal or hexadecimal form, with hexadecimal prefixed with 0x. For example:

${char:0x55}
=> U

compiler

  • ${compiler:[name,]key}

Retrieve the value for a key from the current compiler, or from a specific compiler if the name is provided.

core

  • ${core:[name,]key}

Retrieve the value for a key from the current core, or from a specific core if the name is provided.

csv

  • ${csv:file,col0,colno}

Searches through a CSV file looking for a row where the first column matches col0. It then returns the contents of the colum numbered colno.

env

  • ${env:key}

Get the value associated with an environment variable from the operating system. For example:

${env:HOME}
=> /home/foo

exec

  • ${exec:key}

Execute a key from the current context. If the key points to a UECIDE Script it will begin executing at subkey 0. Otherwise the key will be expanded and executed as a system command.

exists

  • ${exists:/path/to/file}

Tests if a file exists or not. If it does it returns YES. If not, NO.

files

  • `${files:/path/to/directory[,extension]}'

Retrieves the list of files from the specified directory as a comma-separated list. If an extension is provided only the files with that extension will be listed.

find

  • ${find:filename,dir[,dir[...]]}

Searches for a file through a list of directories. The first instance of the file found will be returned as the absolute path to that file.

foreach

  • ${foreach:item[::item[::item[...]]],format}

Iterates through the list of (double-colon separated) items inserting each in turn into format, which is then appended to the returned new list. The format should contain %0 for the location where each item should be inserted.

For example:

${foreach:apples::oranges::pears,I like %0.}
=> I like apples::I like oranges::I like pears

git

  • ${git:hash}
  • ${git:describe}

Retrieve the current commit hash or description from the git information for the current sketch.

if

  • ${if:a=b,true,false}

Test if a equals b (using a simple string comparison). If it matches returns the value in true, otherwise it returns the value in false. For example:

${if:1=2,They match,They don't match}
=> They don't match

java

  • ${java:key}

Retrieve a value from the JVM's System properties.

Note: this is being retired with the move to uecide-cli which no longer uses Java.

join

  • ${join:item[::item[::item[...]]],delimiter}

Join the list of items together using a new delimiter. For example:

${join:apples::oranges::pears,/}
=> apples/oranges/pears

lc

  • ${lc:text}

Convert the provided text into lower case.

math

  • ${math:op[.op[,op[...]]]}

Performs simple Reverse Polish Notation mathematical calculations. Operations supported are +, -, /, *, min, max, sin and cos. All calculations are done as double-precision floating point.

onefile

  • ${onefile:path[,path[,path[...]]]}

Searches a list of files to find one of them. The last instance of a file is returned. This is like find except that it searches for different files not just the same file in different locations. It also differs in that it returns the last file found not the first.

option

  • ${option:key:subkey}

Retrieve the subkey value for a given option. The options are selectable in the Hardware menu. See Options for more information.

optval

  • ${optval:key}

Retrieve the name of the currently selected value for an option. See Options for more information.

os

  • ${os:arch}
  • ${os:version}
  • ${os:flavor}
  • ${os:flavour}

Retrieve information about the operating system UECIDE is running on.

port

  • ${port:key}

Retrieve information about the currently selected communications port.

prefs

  • ${prefs:key}

Retrieve a value from the preferences registry.

preproc

  • ${preproc:file[,key=val[,key=val[...]]]}

Preprocess a text file optionally specifying extra key/value pairs to include in the processing. The file is processed using the standard UECIDE string expansion and variable substitution, so all Variable Commands and all configuration settings are available. The path to the processed file is returned.

programmer

  • ${programmer:[name,]key}

Retrieve the value for a key from the current programmer, or from a specific programmer if the name is provided.

random

  • ${random:low,high}

Generate a random integer between low and high.

replace

  • ${replace:text,old,new}

Replace all instances of old with new in text.

select

  • ${select:key}

Generates an array of available key names that start with the provided key.

sketch

  • ${sketch:key}

Retrieve a value from the current sketch settings.

  • system

  • ${system:command}

Run a system command and return the standard output. Multiple lines are concatenated with ::

tool

  • ${tool:name,key}

Retrieve a value from the specified tool.

uc

  • ${uc:text}

Convert the provided text into upper case.

uecide

  • ${uecide:version}
  • ${uecide:uuid}
  • ${uecide:root}
  • ${uecide:jar}

Get the version of UECIDE, generate a random UUID, and get installation location information about UECIDE itself.

Support Us

Running this server costs money. This server not only hosts this website, but is also the main build platform for creating the download files for UECIDE. Just a couple of pounds (or Dollars, Yen, Mongolian tögrög... we're not fussy) can help to offset the costs.

Alternatively, if you want to be more personal, you could buy me something on Amazon. I have a small wish-list of low-cost items that I'd quite like to receive. Make it a surprise.


Latest WiKi Edits