ArgumentProcessor.DelimiterType
Delimiter

characters included in discription string. the character can be letter or punctuations below: '=', ' ', '/', ',', ';', ''', '"' and '%'

ArgumentProcessor.FlagType
Flag

Commandline argument which can be specified but not need to assigned to values, like --argname or -argabbr. On other word, it's an argument with logical value. If the variable name exist in commandline input, the value will be set to true, otherwise to false

contains:

  • innername varname which will be the name of variable name after parse
  • outername varname which will be displayed and be the input variable name
  • abbreviation abbreviation of outername
  • help help information
ArgumentProcessor.FlagMethod
Flag(innername::AbstractString; outername::AbstractString="", abbr::AbstractString="", help::AbstractString="")
ArgumentProcessor.FlagMethod
`Flag(d::Dict)`

generate Flag type from Dict type. The Dict must contain keys: "innername" and optional keys "outername", "abbr" and "help"

ArgumentProcessor.GroupType
Group

A group of Option and Parameter.

  • name name of the Group
  • flgs collect of Flag
  • opts collect of Option
  • pars collect of Parameter
ArgumentProcessor.GroupMethod
Group(name::AbstractString; flags::Vector{Flag}=Flag[], opts::Vector{Option}=Option[],
      pars::Vector{Parameter}=Parameter[])
ArgumentProcessor.GroupMethod
`Group(d::Dict)`

generate Group type from Dict type. The Dict must contain keys: "name", "flags", "opts" and "pars"

ArgumentProcessor.OptionType
Option

Commandline argument which should be assigned to values, usually spicified like --optname=optval, --optname optval or -Abbreviation optval

contains:

  • innername varname which will be the name of variable name after parse
  • outername varname which will be displayed and be the input variable name
  • abbreviation abbreviation of outername
  • default default value (input as string)
  • parsefmt parse pattern
  • required whether throw error when not exist or not
  • help help information
ArgumentProcessor.OptionMethod
Option(innername::AbstractString; outername::AbstractString="", abbr::AbstractString="",
       default::AbstractString="", fmt::AbstractString="%s", required::Bool=false, help::AbstractString="")

fmt: C like format discription of input format. The discription is a combination of Varformat and Delimiter, and will be appended after the outername. See Varformat and Delimiter for more information.

Example

To parse the commandline argument:

program --test=0.1/0.2

The argument is setted like:

Option("test"; fmt="=%f/%f")
ArgumentProcessor.OptionMethod
`Option(d::Dict)`

generate Option type from Dict type. The Dict must contain keys: "innername" and optional keys "outername", "abbr", "default", "format", "required" and "help"

ArgumentProcessor.ParameterType
Parameter

Commandline argument which can only be distinguished by position, like program par1 par2. Different parameters are seperated by space. And other Delimiter can be used to discribe the input format.

contains:

  • position position of the variable
  • innername varname which will be the name of variable name after parse
  • default default value (input as string)
  • parsefmt parse pattern
  • required whether throw error when not exist or not
  • help help information
ArgumentProcessor.ParameterMethod
`Parameter(d::Dict)`

generate Parameter type from Dict type. The Dict must contain keys: "position" and optional keys "innername", "abbr", "default", "format", "required" and "help"

ArgumentProcessor.ParameterMethod
Parameter(position::Int; innername::AbstractString="", default::AbstractString="", fmt::AbstractString="%s",
          required::Bool=false, help::AbstractString="")

fmt: C like format discription of input format. The discription is a combination of Varformat and Delimiter, and will be appended after the outername. See Varformat and Delimiter for more information.

Example

  1. To parse the commandline argument:
   program 0.1

The argument is setted like:

Option(1; fmt="%f")
  1. commandline argument:
   program 2022/01/01T00:00:00.0

setting:

Option(1; fmt="%d/%d/%dT%d:%d:%f")
ArgumentProcessor.VarformatType
Varformat

must be one of:

  • "%s" string
  • "%f"/"%g" decimal float
  • "%c" complex float
  • "%h" hexadecimal integer
  • "%o" octal integer
  • "%b" binary integer
  • "%d" integer
  • "%l" logical (true, false, 0 or 1)
ArgumentProcessor._parseMethod
`_parse(str::String, fmt::Vector{FormatPart})`

inner function.

parse string to specified format

ArgumentProcessor.addflag!Method
addflag!(innername::AbstractString; outername::AbstractString="",
         abbr::AbstractString="", help::AbstractString="")
ArgumentProcessor.addopt!Method
addopt!(innername::AbstractString; outername::AbstractString="", abbr::AbstractString="",
        default::AbstractString="", fmt::AbstractString="%s", required::Bool=false, help::AbstractString="")
ArgumentProcessor.addpar!Function
addpar!(position::Int; innername::AbstractString="", default::AbstractString="", fmt::AbstractString="%s",
        required::Bool=false, help::AbstractString="")
ArgumentProcessor.helpstrMethod
generate help string from defined groups
helpstr(groups::Vector{Group})

return value:

(usage_line::String, example_line::String, varname_list::Vector{String},
 abbreviation_list::Vector{String}, helps::Vector{String})
ArgumentProcessor.parseMethod
parse string to defined data structure. If there is `--help`, `--usage` or `-h` in commandline,
the program will print help document and exit.
parse(cmdstr::String, grp::Group)
ArgumentProcessor.parseMethod
`parse(lines::Vector{<:AbstractString})`

parse commandline input according to inner buffer

ArgumentProcessor.printhelpFunction
print help doc of defined data structure
printhelp(groups::Vector{Group}; programname::AbstractString="", indent::Int=4,
          maxabbrcol::Int=5, maxvarcol::Int=10, maxdoccol::Int=60)
ArgumentProcessor.printhelpFunction
printhelp(group::Group; programname::AbstractString="", indent::Int=4,
          maxabbrcol::Int=5, maxvarcol::Int=30, maxdoccol::Int=60)