Class ManCommandUsageGenerator
- java.lang.Object
-
- com.github.rvesse.airline.help.common.AbstractUsageGenerator
-
- com.github.rvesse.airline.help.common.AbstractCommandUsageGenerator
-
- com.github.rvesse.airline.help.man.ManCommandUsageGenerator
-
- All Implemented Interfaces:
CommandUsageGenerator
public class ManCommandUsageGenerator extends AbstractCommandUsageGenerator
A command usage generator which generates help in man page (Troff) format
-
-
Field Summary
Fields Modifier and Type Field Description private ManUsageHelperhelperprivate intmanSection-
Fields inherited from class com.github.rvesse.airline.help.common.AbstractUsageGenerator
DEFAULT_COLUMNS
-
-
Constructor Summary
Constructors Constructor Description ManCommandUsageGenerator()ManCommandUsageGenerator(int manSection, boolean includeHidden)Creates a new man page usage generator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ManUsageHelpercreateHelper(boolean includeHidden)protected java.lang.StringgetFullCommandName(java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName)Gets the full command name in man page syntaxprotected <T> voidoutputOptions(TroffPrinter printer, CommandMetadata command, java.util.List<OptionMetadata> options, ParserMetadata<T> parserConfig)Outputs a documentation section detailing the options and their usagesprotected java.util.List<OptionMetadata>outputSynopsis(TroffPrinter printer, java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command)Outputs a synopsis section for the documentation showing how to use a commandprotected voidoutputTitle(TroffPrinter printer, java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command)Outputs a title section for the documentprotected java.lang.StringtoDescription(OptionMetadata option)<T> voidusage(java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command, ParserMetadata<T> parserConfig, java.io.OutputStream output)Generate the help and output it to the stream-
Methods inherited from class com.github.rvesse.airline.help.common.AbstractCommandUsageGenerator
findHelpSections, sortExitCodes, usage, usage
-
Methods inherited from class com.github.rvesse.airline.help.common.AbstractUsageGenerator
getCommandComparator, getOptionComparator, htmlize, includeHidden, sortArgumentsRestrictions, sortCommands, sortOptionRestrictions, sortOptions, toDefaultCommand, toDescription, toSynopsisUsage, toUsage, toUsage
-
-
-
-
Field Detail
-
manSection
private final int manSection
-
helper
private final ManUsageHelper helper
-
-
Constructor Detail
-
ManCommandUsageGenerator
public ManCommandUsageGenerator()
-
ManCommandUsageGenerator
public ManCommandUsageGenerator(int manSection, boolean includeHidden)Creates a new man page usage generator- Parameters:
manSection- Man section to which this command belongs, use constants fromManSectionsincludeHidden- Whether to include hidden items in the help output
-
-
Method Detail
-
createHelper
protected ManUsageHelper createHelper(boolean includeHidden)
-
usage
public <T> void usage(java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command, ParserMetadata<T> parserConfig, java.io.OutputStream output) throws java.io.IOExceptionDescription copied from interface:CommandUsageGeneratorGenerate the help and output it to the stream- Type Parameters:
T- Command type- Parameters:
programName- Program NamegroupNames- Group Name(s)commandName- Command Namecommand- Command MetadataparserConfig- Parser Configuration, ifnullis passed then the parser configuration is automatically determined based on the command class for which we are producing helpoutput- Stream to output to- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputOptions
protected <T> void outputOptions(TroffPrinter printer, CommandMetadata command, java.util.List<OptionMetadata> options, ParserMetadata<T> parserConfig) throws java.io.IOException
Outputs a documentation section detailing the options and their usages- Type Parameters:
T- Command type- Parameters:
printer- Troff Printercommand- Commandoptions- Option meta-dataparserConfig- Parser configuration- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputSynopsis
protected java.util.List<OptionMetadata> outputSynopsis(TroffPrinter printer, java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command) throws java.io.IOException
Outputs a synopsis section for the documentation showing how to use a command- Parameters:
printer- Troff printerprogramName- Program namegroupNames- Group name(s)commandName- Command namecommand- Command- Returns:
- List of all the available options (global, group and command)
- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputTitle
protected void outputTitle(TroffPrinter printer, java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName, CommandMetadata command) throws java.io.IOException
Outputs a title section for the document- Parameters:
printer- Troff PrinterprogramName- Program namegroupNames- Group name(s)commandName- Command namecommand- Command meta-data- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
getFullCommandName
protected java.lang.String getFullCommandName(java.lang.String programName, java.lang.String[] groupNames, java.lang.String commandName) throws java.io.IOExceptionGets the full command name in man page syntax- Parameters:
programName- Program namegroupNames- Group name(s)commandName- Command name- Returns:
- Full command name
- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
toDescription
protected java.lang.String toDescription(OptionMetadata option)
- Overrides:
toDescriptionin classAbstractUsageGenerator
-
-