Example #1
0
 @Override
 public void initOptionsParser(OptionsParser optsParser) {
   optsParser
       .setOption("splitSep=<regex>", "Define custom split seperator.")
       .setOption("joinSep=<regex>", "Define custom join seperator when printing.")
       .setOption("inputFile=<file>", "Specify input file.")
       .setOption("reverseCut", "Keep the cut column and remove others.")
       .setSummary(
           "Split each input line and cut out the zero based column specified.\n"
               + "If no inputFile is given then STDIN is used.\n"
               + "\n"
               + "You may use negative indexing on cutting column. When using negative\n"
               + "indexes, make sure you use \"--\" after thec command so it will not\n"
               + "parse as option flag.\n"
               + "")
       .setUsage("ztool Cut [Options] [cutColumnIdx ...]\n")
       .setExamples(
           "  ztool Cut 2 --inputFile=data.txt\n"
               + "  ztool Printf \"a b c\\nd e f\" | ztool Cut 2\n"
               + "  ztool Printf \"a b c\\nd e f\" | ztool Cut -- -1\n"
               + "  ztool Printf \"a b c\\nd e f\" | ztool Cut -r -- -1\n"
               + "  ztool Printf \"a|b|c\\nd|e|f\" | ztool Cut --splitSep=\"\\|\"\n"
               + "  ztool Printf \"a|b|c\\nd|e|f\" | ztool Cut --splitSep=\"\\|\" 1\n"
               + "");
 }