darcs-2.18.3: a distributed, interactive, smart revision control system
Copyright2005 Benedikt Schmidt
LicenseGPL
Maintainerdarcs-devel@darcs.net
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Documentation

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

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 Source #

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