Class BashCompletionGenerator<T>
java.lang.Object
com.github.rvesse.airline.help.common.AbstractUsageGenerator
com.github.rvesse.airline.help.common.AbstractGlobalUsageGenerator<T>
com.github.rvesse.airline.help.cli.bash.BashCompletionGenerator<T>
- All Implemented Interfaces:
GlobalUsageGenerator<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final charprivate final booleanFields inherited from class AbstractUsageGenerator
DEFAULT_COLUMNS -
Constructor Summary
ConstructorsConstructorDescriptionBashCompletionGenerator(boolean includeHidden, boolean enableDebugging) Creates a new completion generator -
Method Summary
Modifier and TypeMethodDescriptionprivate Stringprivate voidgenerateCommandCompletionFunction(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command) private voidgenerateCommandFunctions(GlobalMetadata<T> global, Writer writer) private voidgenerateGroupCompletionFunction(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group) private voidgenerateGroupFunctions(GlobalMetadata<T> global, Writer writer) protected BashCompletiongetCompletionData(ArgumentsMetadata arguments) Gets the completion info for argumentsprotected BashCompletiongetCompletionData(OptionMetadata option) Gets the completion info for an optionprotected BashCompletiongetCompletionData(Collection<Accessor> accessors) private voidprivate voidvoidusage(GlobalMetadata<T> global, OutputStream output) Generate the help and output it to the streamprivate voidwriteCommandCase(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, int indent, boolean isNestedFunction) private voidwriteCommandFunctionCall(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, int indent) private voidwriteCommandFunctionName(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, boolean declare) private voidwriteCompletionGeneration(Writer writer, int indent, boolean isNestedFunction, BashCompletion completion, String... varNames) private voidwriteFunctionName(Writer writer, GlobalMetadata<T> global, boolean declare) private voidwriteGroupCase(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, int indent) private voidwriteGroupFunctionCall(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, int indent) private voidwriteGroupFunctionName(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, boolean declare) private voidwriteHeader(Writer writer) private voidwriteHelperFunctions(Writer writer) private voidwriteWordListVariable(Writer writer, int indent, String varName, Iterator<String> words) Methods inherited from class AbstractGlobalUsageGenerator
findHelpSections, sortCommandGroups, usageMethods inherited from class AbstractUsageGenerator
getCommandComparator, getOptionComparator, htmlize, includeHidden, sortArgumentsRestrictions, sortCommands, sortOptionRestrictions, sortOptions, toDefaultCommand, toDescription, toDescription, toSynopsisUsage, toUsage, toUsage
-
Field Details
-
NEWLINE
private static final char NEWLINE- See Also:
-
DOUBLE_NEWLINE
- See Also:
-
withDebugging
private final boolean withDebugging
-
-
Constructor Details
-
BashCompletionGenerator
public BashCompletionGenerator() -
BashCompletionGenerator
public BashCompletionGenerator(boolean includeHidden, boolean enableDebugging) Creates a new completion generator- Parameters:
enableDebugging- Whether to enable debugging, when true the generated script will doset -o xtracein its functions andset +o xtraceat the end of its functions
-
-
Method Details
-
usage
Description copied from interface:GlobalUsageGeneratorGenerate the help and output it to the stream- Parameters:
global- Global metadataoutput- Stream to output to- Throws:
IOException- Thrown if there is a problem generating usage output
-
generateCommandFunctions
- Throws:
IOException
-
generateGroupFunctions
- Throws:
IOException
-
writeHeader
- Throws:
IOException
-
writeHelperFunctions
- Throws:
IOException
-
writeCommandCase
private void writeCommandCase(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, int indent, boolean isNestedFunction) throws IOException - Throws:
IOException
-
writeCommandFunctionCall
private void writeCommandFunctionCall(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, int indent) throws IOException - Throws:
IOException
-
writeGroupCase
private void writeGroupCase(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, int indent) throws IOException - Throws:
IOException
-
writeGroupFunctionCall
private void writeGroupFunctionCall(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, int indent) throws IOException - Throws:
IOException
-
generateGroupCompletionFunction
private void generateGroupCompletionFunction(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group) throws IOException - Throws:
IOException
-
generateCommandCompletionFunction
private void generateCommandCompletionFunction(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command) throws IOException - Throws:
IOException
-
indent
- Throws:
IOException
-
repeat
- Throws:
IOException
-
writeWordListVariable
private void writeWordListVariable(Writer writer, int indent, String varName, Iterator<String> words) throws IOException - Throws:
IOException
-
writeFunctionName
private void writeFunctionName(Writer writer, GlobalMetadata<T> global, boolean declare) throws IOException - Throws:
IOException
-
writeGroupFunctionName
private void writeGroupFunctionName(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, boolean declare) throws IOException - Throws:
IOException
-
writeCommandFunctionName
private void writeCommandFunctionName(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, boolean declare) throws IOException - Throws:
IOException
-
writeCompletionGeneration
private void writeCompletionGeneration(Writer writer, int indent, boolean isNestedFunction, BashCompletion completion, String... varNames) throws IOException - Throws:
IOException
-
bashize
-
getCompletionData
Gets the completion info for an option- Parameters:
option- Option- Returns:
- Completion data,
nullif none specified
-
getCompletionData
Gets the completion info for arguments- Parameters:
arguments- Arguments- Returns:
- Completion data,
nullif none specified
-
getCompletionData
-