Package com.martiansoftware.jsap

Examples of com.martiansoftware.jsap.FlaggedOption


    public void testUnexpectedProperties() {
        JSAP jsap = new JSAP();
        try {
            jsap.registerParameter(
                new FlaggedOption(
                    "testflagged",
                    StringStringParser.getParser(),
                    JSAP.NO_DEFAULT,
                    JSAP.NOT_REQUIRED,
                    'f',
View Full Code Here


public class Example1 {

    public static void main(String[] args) throws Exception {
        JSAP jsap = new JSAP();

        FlaggedOption f1 = new FlaggedOption("myflagged");
        f1.setShortFlag('f').setLongFlag("flagged").setRequired(true).setHelp(
            "do flagged stuff");
        jsap.registerParameter(f1);

        UnflaggedOption f2 = new UnflaggedOption("myunflagged");
        f2.setGreedy(JSAP.GREEDY).setHelp("input files");
View Full Code Here

   */
  // @@snip:Manual_HelloWorld_4@@
  public static void main(String[] args) throws Exception {
    JSAP jsap = new JSAP();

    FlaggedOption opt1 = new FlaggedOption("count")
                .setStringParser(JSAP.INTEGER_PARSER)
                .setDefault("1")
                .setRequired(true)
                .setShortFlag('n')
                .setLongFlag(JSAP.NO_LONGFLAG);
View Full Code Here

  public static void main(String[] args) throws Exception {
    SimpleJSAP jsap = new SimpleJSAP(
      "MyProgram",
      "Repeats \"Hello, world!\" multiple times",
      new Parameter[] {
        new FlaggedOption( "count", JSAP.INTEGER_PARSER, "1", JSAP.REQUIRED, 'n', JSAP.NO_LONGFLAG,
          "The number of times to say hello." ),
        new QualifiedSwitch( "verbose", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'v', "verbose",
          "Requests verbose output." ).setList( true ).setListSeparator( ',' ),
        new UnflaggedOption( "name", JSAP.STRING_PARSER, "World", JSAP.REQUIRED, JSAP.GREEDY,
          "One or more names of people you would like to greet." )
View Full Code Here

    // it's going to be an integer, with a default value of 1.
    // it's required (which has no effect since there's a default value)
    // its short flag is "n", so a command line containing "-n 5"
    //    will print our message five times.
    // it has no long flag.
    FlaggedOption opt1 = new FlaggedOption("count")
                .setStringParser(JSAP.INTEGER_PARSER)
                .setDefault("1")
                .setRequired(true)
                .setShortFlag('n')
                .setLongFlag(JSAP.NO_LONGFLAG);
View Full Code Here

   */
  // @@snip:Manual_HelloWorld_5@@
  public static void main(String[] args) throws Exception {
    JSAP jsap = new JSAP();
   
    FlaggedOption opt1 = new FlaggedOption("count")
                .setStringParser(JSAP.INTEGER_PARSER)
                .setDefault("1")
                .setRequired(true)
                .setShortFlag('n')
                .setLongFlag(JSAP.NO_LONGFLAG);
View Full Code Here

   */
  // @@snip:Manual_HelloWorld_3@@
  public static void main(String[] args) throws Exception {
    JSAP jsap = new JSAP();
   
    FlaggedOption opt1 = new FlaggedOption("count")
                .setStringParser(JSAP.INTEGER_PARSER)
                .setDefault("1")
                .setRequired(true)
                .setShortFlag('n')
                .setLongFlag(JSAP.NO_LONGFLAG);
View Full Code Here

   */
  // @@snip:Manual_HelloWorld_7@@
  public static void main(String[] args) throws Exception {
    JSAP jsap = new JSAP();
   
    FlaggedOption opt1 = new FlaggedOption("count")
                .setStringParser(JSAP.INTEGER_PARSER)
                .setDefault("1")
                .setRequired(true)
                .setShortFlag('n')
                .setLongFlag(JSAP.NO_LONGFLAG);

    opt1.setHelp("The number of times to say hello.");
    jsap.registerParameter(opt1);
   
    Switch sw1 = new Switch("verbose")
            .setShortFlag('v')
            .setLongFlag("verbose");
View Full Code Here

    /**
     * Returns a FlaggedOption preconfigured according to this configuration.
     * @return a FlaggedOption preconfigured according to this configuration.
     */
    public Parameter getParameter() {
        FlaggedOption result = new FlaggedOption(this.getId());

        result.setShortFlag(this.getShortflag());
        result.setLongFlag(this.getLongflag());
        result.setRequired(this.getRequired());
        result.setList(this.getIslist());
        if (this.declaredListSeparator()) {
            result.setListSeparator(this.getListseparator());
        }
        if (this.declaredAllowMultipleDeclarations) {
            result.setAllowMultipleDeclarations(this.allowMultipleDeclarations);
        }
        setupStringParser(result);
        result.setDefault(this.getDefaults());
        return (result);
    }
View Full Code Here

      option.setStringParser(stringParser.getConfiguredStringParser());
    }
  }
 
  public Parameter getConfiguredParameter() {
    FlaggedOption result = new FlaggedOption(getId());
    configure(result);
    return (result);
  }
View Full Code Here

TOP

Related Classes of com.martiansoftware.jsap.FlaggedOption

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.