ltsh/typeDB/cut

66 lines
2.2 KiB
Text
Raw Normal View History

::cut OPTION... [FILE]... {
match OPTION... {
--help { <1 : Help~<Seq Char> ; }
2023-10-30 15:30:42 +01:00
--version { <1 : VersionInfo~<Seq Char> ; }
* {
2023-10-30 15:30:42 +01:00
match OPTION... {
-f--fields LIST:<Seq >~CutFieldList~<Seq Char> {
ROW-DELIM =
match OPTION... {
-z--zero-terminated { '\0' }
* { '\n' }
2023-10-30 15:30:42 +01:00
};
IN-COL-DELIM =
match OPTION... {
-d--delimiter DELIM:Char { DELIM }
* { '\t' }
};
OUT-COL-DELIM =
match OPTION... {
2023-10-30 15:30:42 +01:00
--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> ;
}
}
}
}
}