Class ManGlobalUsageGenerator<T>
- java.lang.Object
-
- com.github.rvesse.airline.help.common.AbstractUsageGenerator
-
- com.github.rvesse.airline.help.common.AbstractGlobalUsageGenerator<T>
-
- com.github.rvesse.airline.help.man.ManGlobalUsageGenerator<T>
-
- All Implemented Interfaces:
GlobalUsageGenerator<T>
- Direct Known Subclasses:
ManMultiPageGlobalUsageGenerator
public class ManGlobalUsageGenerator<T> extends AbstractGlobalUsageGenerator<T>
A global usage generator which generates Man pages in Troff format
-
-
Field Summary
Fields Modifier and Type Field Description protected CommandUsageGeneratorcommandUsageGeneratorprotected ManUsageHelperhelperprotected intmanSection-
Fields inherited from class com.github.rvesse.airline.help.common.AbstractUsageGenerator
DEFAULT_COLUMNS
-
-
Constructor Summary
Constructors Modifier Constructor Description ManGlobalUsageGenerator()ManGlobalUsageGenerator(int manSection)ManGlobalUsageGenerator(int manSection, boolean includeHidden)protectedManGlobalUsageGenerator(int manSection, boolean includeHidden, CommandUsageGenerator commandUsageGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ManUsageHelpercreateHelper(boolean includeHidden)protected java.lang.StringgetCommandName(GlobalMetadata<T> global, java.lang.String[] groupNames, CommandMetadata command)Gets the display name for a commandprotected voidoutputCommandList(TroffPrinter printer, GlobalMetadata<T> global)Outputs a documentation section that lists the available commandsprotected voidoutputCommandUsages(java.io.OutputStream output, TroffPrinter printer, GlobalMetadata<T> global)Outputs the command usages for all groupsprotected voidoutputDefaultGroupCommandUsages(java.io.OutputStream output, TroffPrinter printer, GlobalMetadata<T> global)Outputs the command usages for the commands in the default groupprotected voidoutputGroupCommandsList(TroffPrinter printer, GlobalMetadata<T> global, java.util.List<CommandGroupMetadata> groups)protected voidoutputGroupCommandUsages(java.io.OutputStream output, TroffPrinter printer, GlobalMetadata<T> global, java.util.List<CommandGroupMetadata> groups)Outputs the command usages for the commands in the given groupprotected voidoutputGroupList(TroffPrinter printer, GlobalMetadata<T> global)Outputs a documentation section that lists the available groups and the commands they containprotected voidoutputSynopsis(TroffPrinter printer, GlobalMetadata<T> global)Outputs a documentation section with a synopsis of how to use the CLIprotected voidoutputTitle(GlobalMetadata<T> global, TroffPrinter printer)Outputs the title section for the documentationprotected java.lang.StringtoDescription(OptionMetadata option)Converts an option to its description formvoidusage(GlobalMetadata<T> global, java.io.OutputStream output)Generate the help and output it to the stream-
Methods inherited from class com.github.rvesse.airline.help.common.AbstractGlobalUsageGenerator
findHelpSections, sortCommandGroups, 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
-
commandUsageGenerator
protected final CommandUsageGenerator commandUsageGenerator
-
manSection
protected final int manSection
-
helper
protected final ManUsageHelper helper
-
-
Constructor Detail
-
ManGlobalUsageGenerator
public ManGlobalUsageGenerator()
-
ManGlobalUsageGenerator
public ManGlobalUsageGenerator(int manSection)
-
ManGlobalUsageGenerator
public ManGlobalUsageGenerator(int manSection, boolean includeHidden)
-
ManGlobalUsageGenerator
protected ManGlobalUsageGenerator(int manSection, boolean includeHidden, CommandUsageGenerator commandUsageGenerator)
-
-
Method Detail
-
createHelper
protected ManUsageHelper createHelper(boolean includeHidden)
-
usage
public void usage(GlobalMetadata<T> global, java.io.OutputStream output) throws java.io.IOException
Description copied from interface:GlobalUsageGeneratorGenerate the help and output it to the stream- Parameters:
global- Global metadataoutput- Stream to output to- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputGroupList
protected void outputGroupList(TroffPrinter printer, GlobalMetadata<T> global) throws java.io.IOException
Outputs a documentation section that lists the available groups and the commands they containUsed only when a CLI has command groups, if no groups are present then
outputCommandList(TroffPrinter, GlobalMetadata)is used instead.- Parameters:
printer- Troff printerglobal- Global meta-data- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputGroupCommandsList
protected void outputGroupCommandsList(TroffPrinter printer, GlobalMetadata<T> global, java.util.List<CommandGroupMetadata> groups) throws java.io.IOException
- Throws:
java.io.IOException
-
outputCommandList
protected void outputCommandList(TroffPrinter printer, GlobalMetadata<T> global) throws java.io.IOException
Outputs a documentation section that lists the available commandsUsed only when a CLI does not have command groups, if groups are present then
outputGroupList(TroffPrinter, GlobalMetadata)is used instead.- Parameters:
printer- Troff Printerglobal- Global meta-data- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputSynopsis
protected void outputSynopsis(TroffPrinter printer, GlobalMetadata<T> global) throws java.io.IOException
Outputs a documentation section with a synopsis of how to use the CLI- Parameters:
printer- Troff Printerglobal- Global meta-data- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputTitle
protected void outputTitle(GlobalMetadata<T> global, TroffPrinter printer) throws java.io.IOException
Outputs the title section for the documentation- Parameters:
global- Global meta-dataprinter- Troff printer- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputCommandUsages
protected void outputCommandUsages(java.io.OutputStream output, TroffPrinter printer, GlobalMetadata<T> global) throws java.io.IOExceptionOutputs the command usages for all groups- Parameters:
output- Output streamprinter- Writerglobal- Global meta-data- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
getCommandName
protected java.lang.String getCommandName(GlobalMetadata<T> global, java.lang.String[] groupNames, CommandMetadata command)
Gets the display name for a command- Parameters:
global- Global meta-datagroupNames- Group name(s) (may be null)command- Command meta-data- Returns:
- Display name for the command
-
outputGroupCommandUsages
protected void outputGroupCommandUsages(java.io.OutputStream output, TroffPrinter printer, GlobalMetadata<T> global, java.util.List<CommandGroupMetadata> groups) throws java.io.IOExceptionOutputs the command usages for the commands in the given group- Parameters:
output- Outputprinter- Writerglobal- Global Meta-datagroups- Groups Meta-data- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
outputDefaultGroupCommandUsages
protected void outputDefaultGroupCommandUsages(java.io.OutputStream output, TroffPrinter printer, GlobalMetadata<T> global) throws java.io.IOExceptionOutputs the command usages for the commands in the default group- Parameters:
output- Outputprinter- Writerglobal- Global meta-data- Throws:
java.io.IOException- Thrown if there is a problem generating usage output
-
toDescription
protected java.lang.String toDescription(OptionMetadata option)
Converts an option to its description form- Overrides:
toDescriptionin classAbstractUsageGenerator
-
-