darcs-2.18.2: a distributed, interactive, smart revision control system

Copyright | 2005 Benedikt Schmidt
License | GPL
Maintainer | darcs-devel@darcs.net
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Darcs.Util.CommandLine

Description

|A parser for commandlines, returns an arg list and expands format strings given in a translation table. Additionally the commandline can end with "%<" specifying that the command expects input on stdin.

See Darcs.Test.Misc.CommandLine for tests.

Synopsis

- parseCmd :: FTable -> String -> Either ParseError ([String], Bool)
- addUrlencoded :: FTable -> FTable

# Documentation

parseCmd :: FTable -> String -> Either ParseError ([String], Bool) #

parse a commandline returning a list of strings (intended to be used as argv) and a bool value which specifies if the command expects input on stdin format specifiers with a mapping in ftable are accepted and replaced by the given strings. E.g. if the ftable is [(`s`,"Some subject")], then "%s" is replaced by "Some subject"

addUrlencoded :: FTable -> FTable #

for every mapping (c,s), add a mapping with uppercase c and the urlencoded string s