Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2011 Tatsuhiro Tsujikawa
   *
   * Permission is hereby granted, free of charge, to any person
   * obtaining a copy of this software and associated documentation
   * files (the "Software"), to deal in the Software without
   * restriction, including without limitation the rights to use, copy,
   * modify, merge, publish, distribute, sublicense, and/or sell copies
   * of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be
  * included in all copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
 package net.sourceforge.argparse4j.inf;
 

This interface defines Subparsers which used to add Subparser.

Subparser is used to add sub-command to ArgumentParser.

 
 public interface Subparsers {

    

Adds and returns Subparser object with given sub-command name.

The prefixChars is inherited from main ArgumentParser.

Parameters:
command Sub-command name
Returns:
Subparser object.
 
     Subparser addParser(String command);

    

Adds and returns Subparser object with given sub-command name and addHelp.

For addHelp, see net.sourceforge.argparse4j.ArgumentParsers.newArgumentParser(java.lang.String,boolean,java.lang.String). The prefixChars is inherited from main ArgumentParser.

Parameters:
command Sub-command name
addHelp If true, -h/--help are available. If false, they are not.
Returns:
Subparser object
 
     Subparser addParser(String commandboolean addHelp);

    

Adds and returns Subparser object with given sub-command name, addHelp and prefixChars.

For addHelp, see net.sourceforge.argparse4j.ArgumentParsers.newArgumentParser(java.lang.String,boolean,java.lang.String).

Parameters:
command Sub-command name
addHelp If true, -h/--help are available. If false, they are not.
prefixChars The set of characters that prefix optional arguments.
Returns:
Subparser object
 
     Subparser addParser(String commandboolean addHelpString prefixChars);

    
Sets the name of attribute which the selected command name is stored.

Parameters:
dest The name of attribute the selected command name is stored.
Returns:
this.
    Subparsers dest(String dest);

    
Sets the text to display in the help message for sub-commands.

Parameters:
help The text to display in the help message.
Returns:
this
    Subparsers help(String help);

    

Sets the text to display as a title of sub-commands in the help message.

If either title or description(description(java.lang.String)) is specified, sub-command help will be displayed in its own group.

Parameters:
title The text to display as a title of sub-commands
Returns:
this
    Subparsers title(String title);

    

Sets the text to display to briefly describe sub-commands in the help message.

If either description or title(title(java.lang.String)) is specified, sub-command help will be displayed in its own group.

Parameters:
description The text to display to briefly describe sub-commands
Returns:
this
    Subparsers description(String description);

    

Sets the text used to represent sub-commands in help messages.

By default, text to represent sub-commands are concatenation of all sub-commands. This method can override this default behavior and sets arbitrary string to use. This is useful if there are many sub-commands and you don't want to show them all.

Parameters:
metavar The text used to represent sub-commands in help messages
Returns:
this
    Subparsers metavar(String metavar);
New to GrepCode? Check out our FAQ X