diff --git a/documentation/index.rst b/documentation/index.rst index 0bed60cc3..d71beedd9 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -20,6 +20,12 @@ EPICS Base Documentation ComponentReference +.. toctree:: + :titlesonly: + :caption: Command Line Reference + + msi + .. toctree:: :maxdepth: 1 :caption: C/C++ Headers diff --git a/modules/database/src/ioc/dbtemplate/msi.md b/modules/database/src/ioc/dbtemplate/msi.md index bbe5273ef..649683f8e 100644 --- a/modules/database/src/ioc/dbtemplate/msi.md +++ b/modules/database/src/ioc/dbtemplate/msi.md @@ -1,5 +1,8 @@ # msi: Macro Substitution and Include Tool +``` {program} msi +``` + (msitool)= ## Introduction @@ -18,7 +21,9 @@ substitution files accepted by the EPICS IOC's dbLoadTemplate command. ## Command Syntax -`msi -V -g -o outfile -I dir -M subs -S subfile template` +``` bash +msi -V -g -o outfile -I dir -M subs -S subfile template +``` All parameters are optional. The -o, -I, -M, and -S switches may be separated from their associated value string by spaces if desired. @@ -26,80 +31,89 @@ Output will be written to stdout unless the -o option is given. Switches have the following meanings: -- **-V** +::: {option} -V +Verbose warnings; if this parameter is specified then any undefined +macro discovered in the template file which does not have an +associated default value is considered an error. An error message is +generated, and when msi terminates it will do so with an exit status +of 2. +::: - Verbose warnings; if this parameter is specified then any undefined - macro discovered in the template file which does not have an - associated default value is considered an error. An error message is - generated, and when msi terminates it will do so with an exit status - of 2. -- **-g** +::: {option} -g +When this flag is given all macros defined in a substitution file +will have global scope and thus their values will persist until a +new value is given for this macro. This flag is provided for +backwards compatibility as this was the behavior of previous +versions of msi, but it does not follow common scoping rules and is +discouraged. +::: - When this flag is given all macros defined in a substitution file - will have global scope and thus their values will persist until a - new value is given for this macro. This flag is provided for - backwards compatibility as this was the behavior of previous - versions of msi, but it does not follow common scoping rules and is - discouraged. -- **-o _file_** +::: {option} -o +Output will be written to the specifed \ rather than to the +standard output. +::: - Output will be written to the specifed file rather than to the - standard output. -- **-I _dir_** +::: {option} -I +This parameter, which may be repeated or contain a colon-separated +(or semi-colon separated on Windows) list of directory paths, +specifies a search path for include commands. For example: - This parameter, which may be repeated or contain a colon-separated - (or semi-colon separated on Windows) list of directory paths, - specifies a search path for include commands. For example: +``` bash +msi -I /home/mrk/examples:. -I.. template +``` - msi -I /home/mrk/examples:. -I.. template +specifies that all named files should be searched for in the following locations, +in the order given: - specifies that all named files should be searched for in the following locations, - in the order given: +1. `/home/mrk/examples` +2. `.` (the current directory) +3. `..` (the parent of the current directory) - 1. /home/mrk/examples - 2. . (the current directory) - 3. .. (the parent of the current directory) +Note that relative path searching is handled as - Note that relative path searching is handled as - - $ cat foo.substitutions - file rel/path/bar.template { - # contents - } - $ msi -I . -I /some/path foo.substitutions - - which will try to find `bar.template` at the path `./rel/path/` followed by - `/some/path/rel/path`. + $ cat foo.substitutions + file rel/path/bar.template { + # contents + } + $ msi -I . -I /some/path foo.substitutions +which will try to find `bar.template` at the path `./rel/path/` followed by +`/some/path/rel/path`. +::: -- **-M _substitutions_** +::: {option} -M +This parameter specifies macro values for the template instance. +Multiple macro values can be specified in one substitution +parameter, or in multiple -M parameters. For example: - This parameter specifies macro values for the template instance. - Multiple macro values can be specified in one substitution - parameter, or in multiple -M parameters. For example: +``` bash +msi -M "a=aval,b=bval" -Mc=cval template +``` - msi -M "a=aval,b=bval" -Mc=cval template +specifies that in the template file each occurrence of: - specifies that in the template file each occurrence of: +- `$(a)` or `${a}` is replaced by _aval_ +- `$(b)` or `${b}` is replaced by _bval_ +- `$(c)` or `${c}` is replaced by _cval_ +::: - - `$(a)` or `${a}` is replaced by _aval_ - - `$(b)` or `${b}` is replaced by _bval_ - - `$(c)` or `${c}` is replaced by _cval_ +::: {option} -S +The substitution file. See below for format. +::: -- **-S _subfile_** - - The substitution file. See below for format. -- **_template_** - - The input file. If no file is specified then input is taken from - stdin, i.e. msi can be used as a filter. See below for a description - of commands that can be embedded in the template file. +::: {option}