Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Parser for command line arguments
Contributed by: Matteo Salvarezza
A small package to parse command line arguments in a Wolfram Language script.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["Wolfram/CommandLineParser"]
To load the code after installation, evaluate this code:
Needs["Wolfram`CommandLineParser`"]
The functionality offered by this paclet can be divided in two parts:
Specify a command line interface with a single numeric argument:
In[1]:= | ![]() |
Parse settings according to the above specification:
In[2]:= | ![]() |
Out[2]= | ![]() |
ParseCommandLine is meant to be used in Wolfram Language scripts. In the above example command line arguments are explicitly provided as a list of strings, but it's not necessary to do so in a script. When ParseCommandLine is used in a script, its 1-argument form will automatically grab the arguments provided from the command line. When ran from a notebook interface the 1-argument form does not work:
In[3]:= | ![]() |
Out[3]= | ![]() |
See the Tech Notes for the full documentation
Wolfram Language Version 13.0