ltsh/typeDB/cut
2023-10-30 15:30:42 +01:00

65 lines
2.2 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

::cut OPTION... [FILE]... {
match OPTION... {
--help { <1 : Help~<Seq Char> ; }
--version { <1 : VersionInfo~<Seq Char> ; }
* {
match OPTION... {
-f--fields LIST:<Seq >~CutFieldList~<Seq Char> {
ROW-DELIM =
match OPTION... {
-z--zero-terminated { '\0' }
* { '\n' }
};
IN-COL-DELIM =
match OPTION... {
-d--delimiter DELIM:Char { DELIM }
* { '\t' }
};
OUT-COL-DELIM =
match OPTION... {
--output-delimiter STRING:<Seq Char> { STRING }
* { IN-COL-DELIM }
};
FILE : Path
~<Seq PathSegment
~<Seq Char>>
~<SepSeq Char '/'>
~<Seq Char> ;
@FILE : <Seq <* < ITEM~<Seq Char> >... >
~<Seq <Seq Char>>
~<SepSeq Char IN-COL-DELIM>
~<Seq Char>>
~<SepSeq Char ROW-DELIM>
~<Seq Char> ;
>0 : <Seq <* <ITEM~<Seq Char>>... >
~<Seq <Seq Char>>
~<SepSeq Char IN-COL-DELIM>
~<Seq Char>>
~<SepSeq Char ROW-DELIM>
~<Seq Char> ;
# `[LIST]` means `select all fields contained in LIST from parameter pack`
<1 : <Seq <* <ITEM~<Seq Char>>[LIST]... >
~<Seq <Seq Char>>
~<SepSeq Char OUT-COL-DELIM>
~<Seq Char>>
~<SepSeq Char ROW-DELIM>
~<Seq Char> ;
}
* {
<1 : Nothing ;
<2 : MissingFields~ErrorMessage~<Seq Char> ;
}
}
}
}
}