std.argopt
Overview
The argopt package provides the capability of parsing parameter names and values from command line parameter strings.
Command line parameters are passed to a program in the command line and are used to specify the configuration or behavior of the program. For example, a command-line program may have a parameter to specify the name of the file to be processed, or a parameter to specify the database to be used. These parameters are usually parsed and passed to the code of the program so that the program can correctly execute its functions based on these parameters.
Command line parameters are classified into options and non-options based on whether they are prefixed with -.
- Options: prefixed with
-- Short options: prefixed with a single
-and containing only one character - Long options: prefixed with
--and generally containing multiple characters - Short-prefix long options: prefixed with a single
-but containing multiple characters - Short option combinations: prefixed with
-and combining multiple short options in any sequence
- Short options: prefixed with a single
- Non-options: not prefixed with
-
NOTE
All parameters following a single
--are also considered non-options. For example, in-f -- a -b --cde,a,-b, and--cdeare non-options.
API List
Function
| Name | Description |
|---|---|
| parseArguments | Obtains parameters through parsing based on the given input and specifications. |
Class
| Name | Description |
|---|---|
| ArgOpt (deprecated) | Parses command line parameters and obtains parsing results. |
Enums
| Name | Description |
|---|---|
| ArgumentMode | Specifies the parameter mode. |
| ArgumentSpec | Specifies the parameter specifications. |
Struct
| Name | Description |
|---|---|
| ParsedArguments | Specifies the parameter parsing result. |
Exception
| Name | Description |
|---|---|
| ArgumentParseException | Specifies the exception thrown when a parsing error occurs. |