Format strings
Format strings are used for dynamic texts, such as prompts
Format strings are used for prompts, but can also be used directly using the control-format control on any handle that supports output. No tailing new line is added, so it needs to be added manually if required.
538 (* 0) "cat" ~> control %stdout sni:73 "The current tag is: $*\n"
The current tag is: 538 (* 0) "cat"
538 (* 0) "cat" ~>
All formats can be prefixed with <>- and []-sections.
Those sections alter the rendering of the value.
They apply to what is right of them.
Not all variables support all sections and/or modifiers.
<>-sections provide rendering information.
They are similar to printf format string flags and modifiers.
[]-sections provide a way to access sub-elements.
They are parsed as per context-control-parse-value.
Their value is applied to the value using get-value.
Note that if multiple values are given, they are understood right to left
(opposite order of subindexing works in most languages).
If <p> given the first (right-most) value will replace the parameter to the
format variable.
538 (* 0) "cat" ~> control %stdout sni:73 "$<p>[blue]X$<#>*$R\n"
538 (* 0) "cat"
538 (* 0) "cat" ~> control %stdout sni:73 "Terminal is $[sni:39]:x$[sni:38]: charaters big\n"
Terminal is 235x60 charaters big
538 (* 0) "cat" ~>
Currently, the following variables are supported in prompts:
| Variable | Meaning | Example output |
|---|---|---|
$A |
Ampersand | & |
$B |
Pipe | | |
$C |
Opening bracket | ( |
$E |
US-ASCII Escape (0x1B) | N/A |
$F |
Closing bracket | ) |
$G |
Greater than | > |
$H |
Backspace | N/A |
$L |
Less than | < |
$P or $. |
Alias for $* |
538 (* 0) "cat" |
$Q |
Equal | = |
$R |
Clear (reset) terminal attributes | N/A |
$S |
Space | |
$U |
Prints the Unicode character given by param | ▲ |
$V |
Version number | SIRTX 1.2.3 |
$W |
Prints a parma wide fill pattern (by default spaces) | |
$X |
Set the foreground colour to arg | N/A |
$Y |
Set the background colour to arg | N/A |
$Z |
Set the attribute arg | N/A |
$$ |
Dollar sign | $ |
$_ |
New line | N/A |
$* |
Current tag | 538 (* 0) "cat" |
$: |
Output handle | <none> |
$% |
The handle passed as arg | 538 (* 0) "cat" |
$D |
Reserved for current date | N/A |
$T |
Reserved for current time | N/A |
$N |
Reserved for DOS compatibility (current drive) | N/A |
$+ |
Reserved for DOS compatibility (pushd-level) | N/A |
$M |
Reserved for DOS compatibility (remote name of current drive) | N/A |
| All others | Reserved for future use | N/A |