Arg package:hledger

An unnamed argument. Anything not starting with - is considered an argument, apart from "-" which is considered to be the argument "-", and any arguments following "--". For example:
programname arg1 -j - --foo arg3 -- -arg4 --arg5=1 arg6
Would have the arguments:
["arg1","-","arg3","-arg4","--arg5=1","arg6"]
Is at least one of these arguments required, the command line will fail if none are set
The type of data for the argument, i.e. FILE/DIR/EXT
A way of processing the argument.
A helper for addons/scripts: this parses hledger CliOpts from these command line arguments and add-on command names, roughly how hledger main does. If option parsing/validating fails, it exits the program with usageError. Unlike main, this does not read extra args from a config file or search for addons; to do those things, mimic the code in main for now.
cmdargs eats the first double-dash (--) argument when parsing a command line, which causes problems for the run and repl commands. Sometimes we work around this by duplicating that first -- argument. This doesn't break anything that we know of yet.
Expand @ directives in a list of arguments, usually obtained from getArgs. As an example, given the file test.txt with the lines hello and world:
expandArgsAt ["@test.txt","!"] == ["hello","world","!"]
Any @ directives in the files will be recursively expanded (raising an error if there is infinite recursion). To supress @ expansion, pass any @ arguments after --.
Create an argument flag, with an update function and the type of the argument.
Given a sequence of arguments, join them together in a manner that could be used on the command line, giving preference to the Windows cmd shell quoting conventions. For an alternative version, intended for actual running the result in a shell, see "System.Process.showCommandForUser"
The unnamed arguments, a series of arguments, followed optionally by one for all remaining slots
Process the flags obtained by getArgs and expandArgsAt with a mode. Displays an error and exits with failure if the command line fails to parse, or returns the associated value. Implemented in terms of process. This function makes use of the following environment variables:
  • $CMDARGS_COMPLETE - causes the program to produce completions using complete, then exit. Completions are based on the result of getArgs, the index of the current argument is taken from $CMDARGS_COMPLETE (set it to - to complete the last argument), and the index within that argument is taken from $CMDARGS_COMPLETE_POS (if set).
  • $CMDARGS_HELPER/$CMDARGS_HELPER_PROG - uses the helper mechanism for entering command line programs as described in System.Console.CmdArgs.Helper.
Given a string, split into the available arguments. The inverse of joinArgs.
Drop the arguments ("args") from this CliOpts' rawopts field.
Typeclass of printf-formattable values. The formatArg method takes a value and a field format descriptor and either fails due to a bad descriptor or produces a ShowS as the result. The default parseFormat expects no modifiers: this is the normal case. Minimal instance: formatArg.
Calls perror to indicate that there is a type error or similar in the given argument.
Calls perror to indicate that there is a missing argument in the argument list.