Project xenv

xenv

4.1  —  2023-02-23
* Diagnostic directives: $$warning and $$error

The $$warning directive emits warning message.  It does not alter exit
status in any way.

The $$error directive reports a fatal error and sets exit status to
65.

After both directives, processing is resumed at the next line.

* $$exit

New directive $$exit causes immediate termination of the program.
Decimal exit code may be supplied as argument.

* New directive: $$eval

The text between $$eval and $$end is expanded and the resulting
expansion is scanned again, producing the actual output.  This makes
it possible to create variable names on the fly and get their values.
Useful in loops, e.g.:

  $$loop I 0 1 2 3 4 5 6 7
  $$  eval
  \$\$ ifset VAR_$I
  Expand \$VAR_$I;
  \$\$ endif
  $$ end
  $$end

* Bugfixes

** Fix closing the $$range loop.
	  

Xenv is a text preprocessor. It reads input from files (or the standard input, if none are supplied) and prints it on the standard output, replacing references to environment variables with their actual values. Variables are referenced using POSIX-compatible shell syntax: $NAME, ${NAME}, ${NAME:-word}, ${NAME+=word}, ${NAME:=word}, ${NAME:?word}. A special ternary construct is provided: ${NAME:|word1|word2}, which substitutes the expansion of word1 if NAME is set and the expansion of word2 otherwise. Preprocessor directives provide support for inclusion of external files, conditional text expansion (depending on the value of an environment variable or exit code of an external command), diversions, for and foreach loops etc.