License | LGPL-3 |
---|---|
Maintainer | p-w@stty.cz |
Stability | testing |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This is the main (and only) module of the curly-expander package.
Synopsis
- curlyExpand :: Text -> [Text]
- data BackslashConfig
- data ExpandConfig = ExpandConfig {}
- defaultExpandConfig :: ExpandConfig
- customCurlyExpand :: ExpandConfig -> Text -> [Text]
Documentation
curlyExpand :: Text -> [Text] Source #
Curly braces (brackets) expand function
First argument is a Text
, which you want to expand. Second argument is a list of expanded Text
s.
There are given few usage examples:
>>>
curlyExpand "car{A,B}"
["carA","carB"]
>>>
curlyExpand "car{1..5}"
["car1","car2","car3","car4","car5"]
>>>
curlyExpand "car{{A,B},{C,D}}"
["carA", "carB", "carC", "carD"]
>>>
curlyExpand "{car,bus}{A..C}"
["carA", "carB", "carC", "busA", "busB", "busC"]
Be aware, that these examples will run only with OverloadedStrings
language extension and proper Text
imports.
data BackslashConfig Source #
This configuration specify, how should be backslashes handled.
It is part of ExpandConfig
.
NoHandle | If no handle is used, then backslashes are not handled in any special way. |
Preserve | If preserve is used, backslashes are processed, any backslashed char is processed as nonspecial char and backslashes aren't deleted from result. |
Standard | If standard is used, backslashes are processed, any backslashed char is processed as nonspecial char and backslashes are deleted from result. |
Instances
Eq BackslashConfig Source # | |
Defined in Text.CurlyExpander (==) :: BackslashConfig -> BackslashConfig -> Bool # (/=) :: BackslashConfig -> BackslashConfig -> Bool # |
data ExpandConfig Source #
The curly braces expand config.
It is used in customCurlyExpand
.
ExpandConfig | |
|
defaultExpandConfig :: ExpandConfig Source #
The default curly braces expand function config. By default backslashes are not handeled, there are no quote pairs and one element expand is forbidden. See the source code for details.
customCurlyExpand :: ExpandConfig -> Text -> [Text] Source #
Custom curly braces (brackets) expand function.
It works in the same way as curlyExpand, bud accept custom configuration ExpandConfig
in the first argument.