Skip to content

Feature List

00JCIV00 edited this page Apr 27, 2024 · 1 revision

A more in-depth list of Cova's various features. This list is far from complete, but rather covers some common details that aren't covered in the README.

Argument Format

POSIX Compliant by default.

Commands:

  • Contain sub-Commands, Options, and Values.
  • Precede their Options and Values when parsed (i.e. command --option opt_val "value")
  • Infinitely Nestable (i.e. main-cmd --main-opt sub-cmd --sub-opt "sub val")

Options:

  • Wrap Values to make them optional/named and allow them to be given in any order.
  • Can be given multiple times in any valid format (i.e. --int 1 --int=2 -i 3 -i4)
  • Can be Delimited (i.e. -i100,58,80 -f 100.1,84.96,74.58 --bools=true,false,false,true)
  • Short Options:
    • Begin w/ -
    • Chainable (i.e. -abc == -a -b -c)
    • Variable Separators (i.e. -c Tokyo == -c=Tokyo == -cTokyo)
  • Long Options:
    • Begin w/ --
    • Variable Separators (i.e. --city Tokyo == --city=Tokyo)
    • Can be Abbreviated (i.e. --long-option == --long)
  • Customizations:
    • Short & Long Prefixes can be set to any character(s) (i.e. /win-opt vs --posix-opt)
    • Options can be allowed one or more times depending on the needs of your program.
    • Options can be made mandatory so that the end user has to use them.

Values:

  • Also known as Positional Arguments.
  • Do not use prefixes (i.e. command "string value" or command 42)
  • Must be a specific Type given in a specific order. (i.e. command "string_val" 10 true)
  • Can be given multiple times (i.e. my-cmd "string val 1" "string val 2" "string val 3")
  • Can be Delimited (i.e. my-cmd 50,100,68)
  • Customizations (Also inherited by Options):
    • Values can be created from nearly any Zig Type.
    • Value Separators/Delimiters can also be set to any character.
    • Values of Commands can be made optional so that the end user doesn't have to use them.

Aliases

  • Commands and Options can be given aliases to be used in place of their names and long names respectively.
  • Child Types of Values can be aliased so that they make more sense to end users in the Usage/Help messages.

Parsing

  • Auto-handle Usage/Help calls.
  • Choose how errors should be reacted to with either a Usage/Help message or no reaction.
  • Decide if Option parsing should be terminated after a standalone long prefix such as --.

Usage & Help

  • Auto-generated Usage and Help message functions that can be invoked as Commands and/or Options (i.e. command help or command -h/--help)
  • All Argument Types can be configured with Format Strings that control the way Usage and Help messages are created. These are set via Config fields suffixed with _fmt.