forked from GitHub/gf-core
convert all values in shell pipes to strings
This commit is contained in:
@@ -199,15 +199,18 @@ allCommands enc pgf = Map.fromList [
|
|||||||
("full","give full information of the commands"),
|
("full","give full information of the commands"),
|
||||||
("license","show copyright and license information")
|
("license","show copyright and license information")
|
||||||
],
|
],
|
||||||
exec = \opts ts -> return ([], case ts of
|
exec = \opts ts ->
|
||||||
_ | isOpt "changes" opts -> changesMsg
|
let
|
||||||
_ | isOpt "coding" opts -> codingMsg
|
msg = case ts of
|
||||||
_ | isOpt "license" opts -> licenseMsg
|
_ | isOpt "changes" opts -> changesMsg
|
||||||
[t] -> let co = getCommandOp (showTree t) in
|
_ | isOpt "coding" opts -> codingMsg
|
||||||
case lookCommand co (allCommands enc pgf) of ---- new map ??!!
|
_ | isOpt "license" opts -> licenseMsg
|
||||||
Just info -> commandHelp True (co,info)
|
[t] -> let co = getCommandOp (showTree t) in
|
||||||
_ -> "command not found"
|
case lookCommand co (allCommands enc pgf) of ---- new map ??!!
|
||||||
_ -> commandHelpAll enc pgf opts)
|
Just info -> commandHelp True (co,info)
|
||||||
|
_ -> "command not found"
|
||||||
|
_ -> commandHelpAll enc pgf opts
|
||||||
|
in return (fromString msg)
|
||||||
}),
|
}),
|
||||||
("i", emptyCommandInfo {
|
("i", emptyCommandInfo {
|
||||||
longname = "import",
|
longname = "import",
|
||||||
@@ -561,8 +564,8 @@ allCommands enc pgf = Map.fromList [
|
|||||||
fromTrees ts = (ts,unlines (map showTree ts))
|
fromTrees ts = (ts,unlines (map showTree ts))
|
||||||
fromStrings ss = (map (Lit . LStr) ss, unlines ss)
|
fromStrings ss = (map (Lit . LStr) ss, unlines ss)
|
||||||
fromString s = ([Lit (LStr s)], s)
|
fromString s = ([Lit (LStr s)], s)
|
||||||
toStrings ts = [s | Lit (LStr s) <- ts]
|
toStrings = map showAsString
|
||||||
toString ts = unwords [s | Lit (LStr s) <- ts]
|
toString = unwords . toStrings
|
||||||
|
|
||||||
prGrammar opts = case opts of
|
prGrammar opts = case opts of
|
||||||
_ | isOpt "cats" opts -> unwords $ categories pgf
|
_ | isOpt "cats" opts -> unwords $ categories pgf
|
||||||
@@ -581,6 +584,10 @@ allCommands enc pgf = Map.fromList [
|
|||||||
stringOps opts s = foldr app s (reverse opts) where
|
stringOps opts s = foldr app s (reverse opts) where
|
||||||
app f = maybe id id (stringOp f)
|
app f = maybe id id (stringOp f)
|
||||||
|
|
||||||
|
showAsString t = case t of
|
||||||
|
Lit (LStr s) -> s
|
||||||
|
_ -> "\n" ++ showTree t --- newline needed in other cases than the first
|
||||||
|
|
||||||
stringOpOptions = [
|
stringOpOptions = [
|
||||||
("bind","bind tokens separated by Prelude.BIND, i.e. &+"),
|
("bind","bind tokens separated by Prelude.BIND, i.e. &+"),
|
||||||
("chars","lexer that makes every non-space character a token"),
|
("chars","lexer that makes every non-space character a token"),
|
||||||
|
|||||||
Reference in New Issue
Block a user