Cmd module:System

Deprecated: Use System.Process instead
Command function synonym The argument corresponds to the arguments of the command, it may contain spaces or newlines (when input is multi-line). For example, with prefix : and command "command" the argument String for:
:command some arguments
is "some arguments"
This module re-exports the implicit command line parser.
A structure to store the additional data relating to --help, --version, --quiet and --verbose.
Executable & arguments, or shell command. If cwd is Nothing, relative paths are resolved with respect to the current working directory. If cwd is provided, it is implementation-dependent whether relative paths are resolved with respect to cwd or the current working directory, so absolute paths should be used to ensure portability.
Take impurely annotated records and run the corresponding command line. Shortcut for cmdArgsRun . cmdArgsMode. To use cmdArgs with custom command line arguments see withArgs.
Perform the necessary actions dictated by a CmdArgs structure.
Just if --help is given, then gives the help message for display, including a trailing newline.
Take impurely annotated records and turn them in to a Mode value, that can make use of the System.Console.CmdArgs.Explicit functions (i.e. process). Annotated records are impure, and will only contain annotations on their first use. The result of this function is pure, and can be reused.
Take purely annotated records and turn them in to a Mode value, that can make use of the System.Console.CmdArgs.Explicit functions (i.e. process).
Private: Only exported due to Haddock limitations.
Run a Mode structure. This function reads the command line arguments and then performs as follows:
  • If invalid arguments are given, it will display the error message and exit.
  • If --help is given, it will display the help message and exit.
  • If --version is given, it will display the version and exit.
  • In all other circumstances the program will return a value.
  • Additionally, if either --quiet or --verbose is given (see verbosity) it will set the verbosity (see setVerbosity).
The underlying value being wrapped.
Just if --quiet or --verbose is given, then gives the verbosity to use.
Just if --version is given, then gives the version message for display, including a trailing newline.
Take purely annotated records and run the corresponding command line. Shortcut for cmdArgsRun . cmdArgsMode_. To use cmdArgs_ with custom command line arguments see withArgs.
Version of cmdArgs without a Data context, only to be used within cmdArgsQuote.
Version of cmdArgsMode without a Data context, only to be used within cmdArgsQuote.
Quotation function to turn an impure version of System.Console.CmdArgs.Implicit into a pure one. For details see System.Console.CmdArgs.Quote.
Specifies a command line that when parsed will provide Choices
Simple command line parser -- a basic wrapper around the system's default getOpt. See the System.Console.GetOpt manual for a description of the first two parameters. The third parameter is a usage information header. The return value consists of the list of parsed flags and a list of non-option arguments.
Similar to parseCmdLine, but takes an additional function that validates the post-parse command-line arguments. This is useful, for example, in situations where there are two arguments that are mutually-exclusive and only one may legitimately be given at a time. The return value of the function indicates whether or not it detected an error condition. If it returns Nothing, there is no error. If it returns Just String, there was an error, described by the String.