previous | next

The power of angels

The double curly braces {{...}}

Static commands are rarely needed. Most of the time the commands need to be adapted to the present conditions. Angelscripts have different ways to adapt an a-command to specific needs. In general, there is the double-curly braces statement:


{{...}}

The double curly braces offers different functions, like variables, prompting for user input and more.

Asking for parameters

To prompt for user input just before the commands in an a-command are executed, there is the ask-statement:


{{@?:<prompt text>}}

The ask-statement prompt for user input with the 'prompt text' and then replaces itself (the entire {{@?:..}}) with the user input.

Example 6: The ask statement



In the above example, the ask-statement prompts with the parameter “what's the weather, dude?” and then replaces itself with the answer “nice” that was entered by the user.

If the a-command is executed again, the question will be asked again, too. There is no storage of the answer.

angel-variable

The angel-variable or a-variable is essentially a place holder for a value. All occurrences of an angel-variable will have the same value - like a variable. Before a a-command is executed, every a-variable is replaced by its value.

The a-variable has the following form:


{{<variable>}}

To toggle between variables and their values, use


q [enter]

In the below example the a-variable 'mountpoint' stores '/mnt/windows. Another a-variable stores options for the mount command including spaces and comma.

Example 7: Angel-variables




Example 8: A-variables' values



Changing an a-variable

A-variables come with a default value set by the angel. To change an a-variable, use 'd [enter]'.

The variable dialog lists all a-variables used in the current angel. After choosing an a-variable (in this case 'partition'), a list with specific, predefined options for this a-variable is shown. In the above example, we set the variable to '/dev/sda1' by typing 1 [enter].

To enter a new value that is not in the list, simply type [enter] and then add the value you want. [enter] will terminate the line. Newline can not be part of a variable, but spaces and all other characters can.

After setting a variable, the value will be stored for the future. The value is available for all the angelscripts in the same group, i.e. a value set in one angel is set for another angel with the same group.



Example 9: Invoking the variable dialog



Highlighting a-variables

To turn highlighting of a-variables on/off, use: h [enter]



Displaying files

Angelscripts allows to include textfiles into itself. The directive to include files is


{{@file:<path/to/file>}}

Any file can be included in an angel.

In the example below the value 0 is actually the output of file '/proc/sys/net/ipv4/ip_forward' that holds a value to indicate, if IP-forwarding is allowed or not. The example after shows the @file-statement.

One-letter command 'z' toggles between showing the file or it's place holder.


Example 10: Displaying a file inside an angel



Example 11: Displaying the @file statement instead of the file itself