[−][src]Crate dia_args
A command line parser
Project
- Repository: https://bitbucket.org/haibison/dia-args
- License: Free Public License 1.0.0
- This project follows Semantic Versioning 2.0.0
Features
- No debts: no dependencies. It's an argument parser, so standard Rust is enough.
- There's a specification (below). It has a separate version, not same as the library's.
::parse_file()
can be useful: it helps you parse arguments stored in your file.
Specification 0.0.1
A program argument can be:
-
A command.
-
An argument.
-
An option.
-
Two special phrases:
-
and--
.
-
Commands
- A command can be anything which does not start with either
-
or--
.
- A command can be anything which does not start with either
-
Arguments
- Same as a command, an argument can be anything which does not start with either
-
or--
.
- Same as a command, an argument can be anything which does not start with either
-
Options
An option starts with
-
or--
.-
-
supports either:- A single short format option.
- Or multiple short format boolean options.
-
--
supports a single long format option. -
Option values can be anything.
-
An option's key and value can be separated by either:
- An equals sign
=
. - Or mutiple white spaces.
- An equals sign
-
A boolean option has 2 values:
true
andfalse
. The value is optional. If absent,true
will be assigned.
-
-
Special phrases
-
means: the program should process standard input.--
means: the program should process all arguments after it as arguments. This is normally used to pass arguments to sub process.
-
Passing arguments to a program
Must be in this form:
program [command] [arguments...|options...|-] [-- [arguments...]]
in which:
[]
means optional....
means multiple arguments.
Modules
paths | Paths - extensions for |
version_info |
|
Structs
Args | Arguments |
Constants
CODE_NAME | Crate code name |
DIA_ARGS_FILE_NAME | Default file name for storing arguments: |
FALSE_AS_STR |
|
MAX_DIA_ARGS_FILE_SIZE | Maximum size allowed for argument file to be parsed |
NAME | Crate name |
RELEASE_DATE | Crate release date (year/month/day) |
TAG | Tag, which can be used for logging... |
TRUE_AS_STR |
|
UUID | Unique universally identifier of this crate |
VERSION | Crate version |
Functions
parse | Parses from process' arguments |
parse_file | Parses from file |
parse_strings | Parses from an iterator of strings |
read_line | Reads a line from stdin, trims and converts it to |