CmdID

CmdID / Commands

getopt

Outputs command line with recognized OPTIONS character arguments moved to front, then "--", then non-option arguments. toybox

On Linux

Opens CmdID with your command. It is read in your browser and sent nowhere.

Linux

from the toybox, 0BSD

Outputs command line with recognized OPTIONS character arguments moved to front, then "--", then non-option arguments. Returns 1 if unknown options. OPTIONS followed by : take an argument, or :: for optional arguments (which must be attached, ala -xblah or --long=blah).

getopt [-aTu] [-lo OPTIONS] [-n NAME] [OPTIONS] ARG...
-aAllow long options starting with a single -
-l OPTIONSLong OPTIONS (repeated or comma separated)
-n NAMECommand NAME for error messages
-o OPTIONSShort OPTIONS (instead of using first argument)
-TTest whether this is a modern getopt
-uUnquoted output (default if no other options set) $ getopt -l long:,arg:: abc command --long -b there --arg
--long'-b' --arg '' -- 'command' 'there'

Parse command-line arguments.

Parse optional verbose/version flags with shorthands

getopt --options vV --longoptions verbose,version -- --version --verboseIdentify

Add a --file option with a required argument with shorthand -f

getopt --options f: --longoptions file: -- --file=somefileIdentify

Add a --verbose option with an optional argument with shorthand -v, and pass a non-option parameter arg

getopt --options v:: --longoptions verbose:: -- --verbose argIdentify

Accept a -r and --verbose flag, a --accept option with an optional argument, and add a --target with a required argument option with shorthands

getopt --options rv::s::t: --longoptions verbose,source::,target: -- -v --target targetIdentify