| License | BSD3 |
|---|---|
| Maintainer | tbidne@gmail.com |
| Safe Haskell | Safe |
| Language | Haskell2010 |
CLI.Internal
Description
Provides a function that parses command keys into their values.
Documentation
translateCommands :: Map Text Text -> [Text] -> [Text] Source #
Returns a list of Text commands, potentially transforming a
given string via the Map legend.
For a string \(s = s_1,\ldots,s_n\), we split \(s\) by commas then recursively search on each \(s_i\). We stop and return \(s_i\) when it does not exist as a key in the map.
For example,
m = { "cmd1": "one", "cmd2": "two", "all": "cmd1,cmd2,other" }
translateCommands m ["all", "blah"] == ["one", "two", "other", "blah"]