Add data table fsck options to the command line parser
@param argp The parser to add options to
346425
public static void addDataOptions(final ArgP argp) {
    argp.addOption("--full-scan", "Scan the entire data table.");
    argp.addOption("--fix", "Fix errors as they're found. Use in combination with"
        + " other flags.");
    argp.addOption("--fix-all", "Set all flags and fix errors as they're found.");
    argp.addOption("--compact", "Compacts rows after parsing.");
    argp.addOption("--resolve-duplicates", 
        "Keeps the oldest (default) or newest duplicates. See --last-write-wins");
    argp.addOption("--last-write-wins", 
        "Last data point written will be kept when fixing duplicates.\n" +
        "            May be set via config file and the 'tsd.storage.fix_duplicates' option.");
    argp.addOption("--delete-orphans", 
        "Delete any time series rows where one or more UIDs fail resolution.");
    argp.addOption("--delete-unknown-columns", 
        "Delete any unrecognized column that doesn't belong to OpenTSDB.");
    argp.addOption("--delete-bad-values", 
        "Delete single column datapoints with bad values.");
    argp.addOption("--delete-bad-rows", "Delete rows with invalid keys.");
    argp.addOption("--delete-bad-compacts", 
        "Delete compacted columns that cannot be parsed.");
    argp.addOption("--threads", "NUMBER",
        "Number of threads to use when executing a full table scan.");
    argp.addOption("--sync", "Wait for each fix operation to finish to continue.");
  }
59719
public static void main(String[] args) {

    try {

      SAXCLIParameters params = new SAXCLIParameters();
      JCommander jct = new JCommander(params, args);

      if (0 == args.length) {
        jct.usage();
      }
      else {
        // get params printed
        //
        StringBuffer sb = new StringBuffer(1024);
        sb.append("SAX CLI converter v.1").append(CR);
        sb.append("parameters:").append(CR);

        sb.append("  input file:                  ").append(SAXCLIParameters.IN_FILE).append(CR);
        sb.append("  output file:                 ").append(SAXCLIParameters.OUT_FILE).append(CR);
        sb.append("  SAX sliding window size:     ").append(SAXCLIParameters.SAX_WINDOW_SIZE)
            .append(CR);
        sb.append("  SAX PAA size:                ").append(SAXCLIParameters.SAX_PAA_SIZE)
            .append(CR);
        sb.append("  SAX alphabet size:           ").append(SAXCLIParameters.SAX_ALPHABET_SIZE)
            .append(CR);
        sb.append("  SAX numerosity reduction:    ").append(SAXCLIParameters.SAX_NR_STRATEGY)
            .append(CR);
        sb.append("  SAX normalization threshold: ").append(SAXCLIParameters.SAX_NORM_THRESHOLD)
            .append(CR);
        sb.append("  threads to use:              ").append(SAXCLIParameters.THREADS_NUM)
            .append(CR);

        String dataFName = SAXCLIParameters.IN_FILE;
        double[] ts = TSProcessor.readFileColumn(dataFName, 0, 0);

        Integer slidingWindowSize = Integer.valueOf(SAXCLIParameters.SAX_WINDOW_SIZE);
        Integer paaSize = Integer.valueOf(SAXCLIParameters.SAX_PAA_SIZE);
        Integer alphabetSize = Integer.valueOf(SAXCLIParameters.SAX_ALPHABET_SIZE);

        NumerosityReductionStrategy nrStrategy = SAXCLIParameters.SAX_NR_STRATEGY;

        Double nThreshold = SAXCLIParameters.SAX_NORM_THRESHOLD;

        NormalAlphabet na = new NormalAlphabet();
        SAXProcessor sp = new SAXProcessor();

        Integer threadsNum = SAXCLIParameters.THREADS_NUM;
        
        SAXRecords res = null;

        if (threadsNum > 1) {
          ParallelSAXImplementation ps = new ParallelSAXImplementation();
          res = ps.process(ts, threadsNum, slidingWindowSize, paaSize, alphabetSize, nrStrategy,
              nThreshold);
        }
        else {
          res = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize, na.getCuts(alphabetSize),
              nrStrategy, nThreshold);
        }

        ArrayList<Integer> indexes = new ArrayList<Integer>();
        indexes.addAll(res.getIndexes());
        Collections.sort(indexes);

        BufferedWriter bw = new BufferedWriter(new FileWriter(new File(SAXCLIParameters.OUT_FILE)));
        for (Integer idx : indexes) {
          bw.write(idx + COMMA + String.valueOf(res.getByIndex(idx).getPayload()) + CR);
        }
        bw.close();

      }
    }
    catch (IOException | SAXException e) {
      System.err.println("error occured while parsing parameters " + Arrays.toString(args) + CR
          + StackTrace.toString(e));
      System.exit(-1);
    }

  }
578629
protected void processSystemArg(DefaultCommandLine cl, String arg) {
        int i = arg.indexOf("=");
        String name = arg.substring(2, i);
        String value = arg.substring(i + 1, arg.length());
        cl.addSystemProperty(name, value);
    }
102693
public static void main(String args[]) {
		SmapGenerator g = new SmapGenerator();
		g.setOutputFileName("foo.java");
		SmapStratum s = new SmapStratum("JSP");
		s.addFile("foo.jsp");
		s.addFile("bar.jsp", "/foo/foo/bar.jsp");
		s.addLineData(1, "foo.jsp", 1, 1, 1);
		s.addLineData(2, "foo.jsp", 1, 6, 1);
		s.addLineData(3, "foo.jsp", 2, 10, 5);
		s.addLineData(20, "bar.jsp", 1, 30, 1);
		g.addStratum(s, true);
		System.out.print(g);

		System.out.println("---");

		SmapGenerator embedded = new SmapGenerator();
		embedded.setOutputFileName("blargh.tier2");
		s = new SmapStratum("Tier2");
		s.addFile("1.tier2");
		s.addLineData(1, "1.tier2", 1, 1, 1);
		embedded.addStratum(s, true);
		g.addSmap(embedded.toString(), "JSP");
		System.out.println(g);
	}
180934
private static void parseOptions(String args[])
  {
    if (!(args.length == 14 || args.length == 12 || args.length == 5)) {
      usage();
    }

    /*
     * As described in usage():
     * -s dfs-server
     * -p dfs-port [-t [create|create-write|stat|readdir|read|rename|delete]
     * -a planfile-path
     * -c host
     * -n process-name
     * -P prefix
     */
    for (int i = 0; i < args.length; i++) {
      if (args[i].equals("-s") && i+1 < args.length) {
        dfsServer_ = args[i+1];
        System.out.println(args[i+1]);
        i++;
      } else if (args[i].equals("-p") && i+1 < args.length) {
        dfsPort_ = Integer.parseInt(args[i+1]);
        System.out.println(args[i+1]);
        i++;
      } else if (args[i].equals("-t") && i+1 < args.length) {
        testName_ = args[i+1];
        System.out.println(args[i+1]);
        i++;
      } else if (args[i].equals("-a") && i+1 < args.length) {
        planfilePath_ = args[i+1];
        System.out.println(args[i+1]);
        i++;
      } else if (args[i].equals("-c") && i+1 < args.length) {
        hostName_ = args[i+1];
        System.out.println(args[i+1]);
        i++;
      } else if (args[i].equals("-n") && i+1 < args.length) {
        processName_ = args[i+1];
        System.out.println(args[i+1]);
        i++;
      } else if (args[i].equals("-P") && i+1 < args.length) {
        prefix_ = args[i+1];
        System.out.println(args[i+1]);
        i++;
      }
    }

    if (dfsServer_.length() == 0    ||
        testName_.length() == 0     ||
        planfilePath_.length() == 0 ||
        hostName_.length() == 0     ||
        processName_.length() == 0  ||
        dfsPort_ == 0) {
      usage();
    }
    if (prefix_ == null) {
      prefix_ = new String("PATH_PREFIX_");
    }
    prefixLen_ = prefix_.length();
  }
1338243
static void parseData(String[] args, BiConsumer<String, Boolean> data) {
        CommandLine commandLine = parseCommandLine(args);
        Object value = commandLine.optionValue("d");
        if (value != null) {
            data.accept(value.toString(), commandLine.hasOption("x"));
        } else {
            data.accept(null, commandLine.hasOption("x"));
        }
    }
306085
def add_argparser(self, root, parents):
        
        parser = root.add_parser('diff', parents=parents)
        parser.set_defaults(func=self)

        parser.add_argument(
            '--secrets',
            dest='secrets', action='store',
            help='Path to the authorization secrets file (client_secrets.json).'
        )

        parser.add_argument(
            '-d', '--data',
            dest='data_path', action='store', default=None,
            help='Path to a existing JSON diff file.'
        )

        parser.add_argument(
           'report_a_path',
            action='store',
            help='Path to a JSON file containing the initial report data.'
        )

        parser.add_argument(
           'report_b_path',
            action='store',
            help='Path to a JSON file containing the report data to compare.'
        )

        parser.add_argument(
            'output_path',
            action='store',
            help='Path to output either an HTML report or a JSON data file.'
        )

        return parser
1208796
static public void main (String[] args) throws Exception {
		if (args.length == 0) {
			String commandLine = "-f 0 -wi 1 -i 1 -t 1 -w 1s -r 1s " // For developement only (fork 0, short runs).
			// + "-bs 2500000 ArrayBenchmark" //
			// + "-rf csv FieldSerializerBenchmark.field FieldSerializerBenchmark.tagged" //
			// + "FieldSerializerBenchmark.tagged" //
			;
			System.out.println(commandLine);
			args = commandLine.split(" ");
		}
		Main.main(args);
	}
1245536
public static void main(String[] args) {
    if (args.length < 2) {
      System.err.println("Input and output files not provided");
      System.err
          .println("You need to provide both the input serialized java fst model");
      System.err.println("and the output binary openfst model.");
      System.exit(1);
    }

    MutableFst fst = FstInputOutput.readFstFromBinaryResource(args[0]);

    // Serialize the java fst model to disk
    System.out.println("Saving as openfst text model...");
    Convert.export(fst, args[1]);
  }
452011
static CommandLine parseCommandLine(String[] args) {
        return CommandLine.build()
            .addOption(DATA_OPTION, "For passing the data")
            .addOption(DEBUG_OPTIONS, "For outputting debug information")
            .parse(args);
    }
414996
def add_basic_executor_options(argument_parser):
    """"""
    argument_parser.add_argument("args", nargs="+", metavar="ARG",
        help='command line to run (prefix with "--" to ensure all arguments are treated correctly)')
    argument_parser.add_argument("--version", action="version", version="%(prog)s " + __version__)

    verbosity = argument_parser.add_mutually_exclusive_group()
    verbosity.add_argument("--debug", action="store_true",
                           help="show debug output")
    verbosity.add_argument("--quiet", action="store_true",
                           help="show only warnings")
937390
public static void main(final String[] args) {
        Switch about = new Switch("a", "about", "display about message");
        Switch help = new Switch("h", "help", "display help message");
        StringListArgument snpIdFilter = new StringListArgument("s", "snp-ids", "filter by snp id", true);
        FileArgument inputVcfFile = new FileArgument("i", "input-vcf-file", "input VCF file, default stdin", false);
        FileArgument outputVcfFile = new FileArgument("o", "output-vcf-file", "output VCF file, default stdout", false);

        ArgumentList arguments = new ArgumentList(about, help, snpIdFilter, inputVcfFile, outputVcfFile);
        CommandLine commandLine = new CommandLine(args);

        FilterVcf filterVcf = null;
        try {
            CommandLineParser.parse(commandLine, arguments);
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            filterVcf = new FilterVcf(new IdFilter(snpIdFilter.getValue()), inputVcfFile.getValue(), outputVcfFile.getValue());
        }
        catch (CommandLineParseException e) {
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        catch (NullPointerException e) {
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        try {
            System.exit(filterVcf.call());
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
1367994
public static void main(String[] args) throws Exception {

    SAXProcessor sp = new SAXProcessor();

    // data
    //
    double[] dat = TSProcessor.readFileColumn(DAT_FNAME, 1, 0);
    // TSProcessor tp = new TSProcessor();
    // double[] dat = tp.readTS("src/resources/dataset/asys40.txt", 0);
    // double[] dat = TSProcessor.readFileColumn(filename, columnIdx,
    // sizeLimit)FileColumn(DAT_FNAME, 1, 0);
    LOGGER.info("read {} points from {}", dat.length, DAT_FNAME);

    String str = "win_width: " + cPoint + "; SAX: W " + SAX_WINDOW_SIZE + ", P " + SAX_PAA_SIZE
        + ", A " + SAX_ALPHABET_SIZE + ", STR " + SAX_NR_STRATEGY.toString();

    int frameCounter = 0;
    int startOffset = cPoint;
    while (cPoint < dat.length - startOffset - 1) {

      if (0 == cPoint % 2) {

        BufferedImage tsChart = getChart(dat, cPoint);

        // bitmap 1
        //
        double[] win1 = Arrays.copyOfRange(dat, cPoint - startOffset, cPoint);
        Map<String, Integer> shingledData1 = sp.ts2Shingles(win1, SAX_WINDOW_SIZE, SAX_PAA_SIZE,
            SAX_ALPHABET_SIZE, SAX_NR_STRATEGY, SAX_NORM_THRESHOLD, SHINGLE_SIZE);
        BufferedImage pam1 = getHeatMap(shingledData1, "pre-window");

        double[] win2 = Arrays.copyOfRange(dat, cPoint, cPoint + startOffset);
        Map<String, Integer> shingledData2 = sp.ts2Shingles(win2, SAX_WINDOW_SIZE, SAX_PAA_SIZE,
            SAX_ALPHABET_SIZE, SAX_NR_STRATEGY, SAX_NORM_THRESHOLD, SHINGLE_SIZE);
        BufferedImage pam2 = getHeatMap(shingledData2, "post-window");

        // the assemble
        //
        BufferedImage target = new BufferedImage(800, 530, BufferedImage.TYPE_INT_ARGB);
        Graphics targetGraphics = target.getGraphics();
        targetGraphics.setColor(Color.WHITE);
        targetGraphics.fillRect(0, 0, 799, 529);

        targetGraphics.drawImage(tsChart, 0, 0, null);

        targetGraphics.drawImage(pam1, 10, 410, null);// draws the first image onto it

        targetGraphics.drawImage(pam2, 120, 410, null);// draws the first image onto it

        targetGraphics.setColor(Color.RED);
        targetGraphics.setFont(new Font("monospaced", Font.PLAIN, 16));
        targetGraphics.drawString(str, 300, 420);

        targetGraphics.setColor(Color.BLUE);
        targetGraphics.setFont(new Font("monospaced", Font.PLAIN, 24));
        double dist = ed.distance(toVector(shingledData1), toVector(shingledData2));
        targetGraphics.drawString("ED=" + df.format(dist), 300, 480);

        // String fileName = new SimpleDateFormat("yyyyMMddhhmmssSS'.png'").format(new Date());
        File outputfile = new File("dframe" + String.format("%04d", frameCounter) + ".png");
        ImageIO.write(target, "png", outputfile);
        frameCounter++;
      }

      cPoint++;
    }
  }
1204172
def add_command_line_options(cls, parser):
        """"""
        if "add_argument" in dir(parser):
            return cls.add_command_line_options_argparse(parser)
        else:
            return cls.add_command_line_options_optparse(parser)
1282292
public void add(final String arg) {
        if (arg != null) {
            final Argument argument = parse(arg);
            add(argument);
        }
    }
10509
public static void main(String [] args){
		displayCopyright();        
        if (!checkArgs(args)) {
            displayHelp();
            return;
        }
        
      //get model dir
        String modelDir = args[1];
        CRFSegmenter segmenter = new CRFSegmenter(modelDir);
        
      //tagging
        try {
        	System.out.println(args[2]);
	        if (args[2].equalsIgnoreCase("-inputfile")){
	        	System.out.println(args[3]);
	        	File inputFile = new File(args[3]);
	        	BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
	        			new FileOutputStream(inputFile.getPath() + ".wseg"), "UTF-8"));
	        	
	        	String result = segmenter.segmenting(inputFile);
	        	
	        	writer.write(result);
	        	writer.close();
	        }
	        else{ //input dir
	        	String inputDir = args[3];
	        	 if (inputDir.endsWith(File.separator)) {
		                inputDir = inputDir.substring(0, inputDir.length() - 1);
		            }
		            
		            File dir = new File(inputDir);
		            String[] children = dir.list(new FilenameFilter() {
		                public boolean accept(File dir, String name) {
		                    return name.endsWith(".tkn");
		                }
		            });    
		            
		            for (int i = 0; i < children.length; i++) {
		            	System.out.println("Segmenting " + children[i]);
		            	String filename = inputDir + File.separator + children[i];
			                if ((new File(filename)).isDirectory()) {
			                    continue;
			            }
			                
			            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
				        			new FileOutputStream(filename + ".wseg"), "UTF-8"));
			             
			            writer.write(segmenter.segmenting(new File(filename)));
			             
			            writer.close();
		            }
	        }
        }
        catch (Exception e){
        	System.out.println("Error while segmenting");
        	System.out.println(e.getMessage());
        	e.printStackTrace();
        }
	}
694763
def add_arguments(cls, parser, sys_arg_list=None):
        
        parser.add_argument('--tcp_check_interval',
                            dest='tcp_check_interval',
                            required=False, default=2, type=float,
                            help="TCP health-test interval in seconds, "
                                 "default 2 "
                                 "(only for 'tcp' health monitor plugin)")
        parser.add_argument('--tcp_check_port',
                            dest='tcp_check_port',
                            required=False, default=22, type=int,
                            help="Port for TCP health-test, default 22 "
                                 "(only for 'tcp' health monitor plugin)")
        return ["tcp_check_interval", "tcp_check_port"]