Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Parse a command, returning a Dataset of all flags present and their associated parameter values
ResourceFunction["CommandLineParse"][] parses flags and parameters in $CommandLine and returns an associated Dataset of parameters and values. | |
ResourceFunction["CommandLineParse"]["cmd"] parses flags and parameters in the command string "cmd". | |
ResourceFunction["CommandLineParse"]["-flag"] returns parameters associated with flag in $CommandLine. | |
ResourceFunction["CommandLineParse"]["cmd", "-flag"] returns parameters associated with flag in "cmd". |
Parse the current session's $CommandLine:
In[1]:= | ![]() |
Out[1]= | ![]() |
Parse a command string:
In[2]:= | ![]() |
Out[2]= | ![]() |
Parse a command list:
In[3]:= | ![]() |
Out[3]= | ![]() |
Parse a compound command:
In[4]:= | ![]() |
Out[4]= | ![]() |
In[5]:= | ![]() |
Out[5]= | ![]() |
Parse $CommandLine returning the parameters associated to the "linkmode" flag:
In[6]:= | ![]() |
Out[6]= | ![]() |
Parse a command list for multiple flags:
In[7]:= | ![]() |
Out[7]= | ![]() |
Parse a compound command for a flag:
In[8]:= | ![]() |
Out[8]= | ![]() |
A Failure object is returned if the flag is not found:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
$Failed is returned if an unknown input is received:
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License