Previous: Filter Mode, Up: Modes of Operation


1.2.2 Parameter Mode

In parameter mode, the argument to the function given by the virtual code is a data structure containing environment variables and command line parameters including files, application specific options, and possibly standard input. The result obtained by evaluating the function is either a data structure representing a set of files to be written, which may include standard output, or a sequence of shell commands to be executed, or a combination of both. Parameter mode is indicated whenever either of these conditions is met.

Examples:

avram --map-to-each-file prettyprinter.avm *.c *.h --extra-pretty
In this example, parameter mode is indicated both by the parameter mode option --map-to-each-file and by the presence of input file names and the --extra-pretty option. The latter is specific to the hypothetical prettyprinter.avm virtual code application, as indicated by its position on the command line, and is therefore passed to it by avram.
cat ~/specfile | avram reportgenerator -v - /var/log/syslog
In this example, a hypothetical parameter mode application reportgenerator is able to read ~/specfile from standard input because of the - used as a parameter.
avram --parameterized grepenv
In this example, a hypothetical application that searches shell variables is invoked in parameter mode even with no input files or application specific options, because of the --parameterized option. Parameter mode invocation is required by the application to give it access to the environment.
avram grepenv --search-targets=PATH,MANPATH
This example shows an application specific option with both a keyword and a parameter list. They suffice to indicate parameter mode without an explicit --parameterized option.