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
A command usage generator which generates help in man page (Troff) format
-
Field Summary
FieldsFields inherited from class AbstractUsageGenerator
DEFAULT_COLUMNS -
Constructor Summary
ConstructorsConstructorDescriptionManCommandUsageGenerator(int manSection, boolean includeHidden) Creates a new man page usage generator -
Method Summary
Modifier and TypeMethodDescriptionprotected ManUsageHelpercreateHelper(boolean includeHidden) protected StringgetFullCommandName(String programName, String[] groupNames, String commandName) Gets the full command name in man page syntaxprotected <T> voidoutputOptions(TroffPrinter printer, CommandMetadata command, List<OptionMetadata> options, ParserMetadata<T> parserConfig) Outputs a documentation section detailing the options and their usagesprotected List<OptionMetadata> outputSynopsis(TroffPrinter printer, String programName, String[] groupNames, String commandName, CommandMetadata command) Outputs a synopsis section for the documentation showing how to use a commandprotected voidoutputTitle(TroffPrinter printer, String programName, String[] groupNames, String commandName, CommandMetadata command) Outputs a title section for the documentprotected StringtoDescription(OptionMetadata option) <T> voidusage(String programName, String[] groupNames, String commandName, CommandMetadata command, ParserMetadata<T> parserConfig, OutputStream output) Generate the help and output it to the streamMethods inherited from class AbstractCommandUsageGenerator
findHelpSections, sortExitCodes, usage, usageMethods inherited from class AbstractUsageGenerator
getCommandComparator, getOptionComparator, htmlize, includeHidden, sortArgumentsRestrictions, sortCommands, sortOptionRestrictions, sortOptions, toDefaultCommand, toDescription, toSynopsisUsage, toUsage, toUsage
-
Field Details
-
manSection
private final int manSection -
helper
-
-
Constructor Details
-
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 Details
-
createHelper
-
usage
public <T> void usage(String programName, String[] groupNames, String commandName, CommandMetadata command, ParserMetadata<T> parserConfig, OutputStream output) throws IOException Description 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:
IOException- Thrown if there is a problem generating usage output
-
outputOptions
protected <T> void outputOptions(TroffPrinter printer, CommandMetadata command, List<OptionMetadata> options, ParserMetadata<T> parserConfig) throws 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:
IOException- Thrown if there is a problem generating usage output
-
outputSynopsis
protected List<OptionMetadata> outputSynopsis(TroffPrinter printer, String programName, String[] groupNames, String commandName, CommandMetadata command) throws 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:
IOException- Thrown if there is a problem generating usage output
-
outputTitle
protected void outputTitle(TroffPrinter printer, String programName, String[] groupNames, String commandName, CommandMetadata command) throws IOException Outputs a title section for the document- Parameters:
printer- Troff PrinterprogramName- Program namegroupNames- Group name(s)commandName- Command namecommand- Command meta-data- Throws:
IOException- Thrown if there is a problem generating usage output
-
getFullCommandName
protected String getFullCommandName(String programName, String[] groupNames, String commandName) throws IOException Gets the full command name in man page syntax- Parameters:
programName- Program namegroupNames- Group name(s)commandName- Command name- Returns:
- Full command name
- Throws:
IOException- Thrown if there is a problem generating usage output
-
toDescription
- Overrides:
toDescriptionin classAbstractUsageGenerator
-