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 String
private static final char
private final boolean
Fields inherited from class com.github.rvesse.airline.help.common.AbstractUsageGenerator
DEFAULT_COLUMNS
-
Constructor Summary
ConstructorsConstructorDescriptionBashCompletionGenerator
(boolean includeHidden, boolean enableDebugging) Creates a new completion generator -
Method Summary
Modifier and TypeMethodDescriptionprivate String
private void
generateCommandCompletionFunction
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command) private void
generateCommandFunctions
(GlobalMetadata<T> global, Writer writer) private void
generateGroupCompletionFunction
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group) private void
generateGroupFunctions
(GlobalMetadata<T> global, Writer writer) protected BashCompletion
getCompletionData
(ArgumentsMetadata arguments) Gets the completion info for argumentsprotected BashCompletion
getCompletionData
(OptionMetadata option) Gets the completion info for an optionprotected BashCompletion
getCompletionData
(Collection<Accessor> accessors) private void
private void
void
usage
(GlobalMetadata<T> global, OutputStream output) Generate the help and output it to the streamprivate void
writeCommandCase
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, int indent, boolean isNestedFunction) private void
writeCommandFunctionCall
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, int indent) private void
writeCommandFunctionName
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, CommandMetadata command, boolean declare) private void
writeCompletionGeneration
(Writer writer, int indent, boolean isNestedFunction, BashCompletion completion, String... varNames) private void
writeFunctionName
(Writer writer, GlobalMetadata<T> global, boolean declare) private void
writeGroupCase
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, int indent) private void
writeGroupFunctionCall
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, int indent) private void
writeGroupFunctionName
(Writer writer, GlobalMetadata<T> global, CommandGroupMetadata group, boolean declare) private void
writeHeader
(Writer writer) private void
writeHelperFunctions
(Writer writer) private void
writeWordListVariable
(Writer writer, int indent, String varName, Iterator<String> words) 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, 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 xtrace
in its functions andset +o xtrace
at the end of its functions
-
-
Method Details
-
usage
Description copied from interface:GlobalUsageGenerator
Generate 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,
null
if none specified
-
getCompletionData
Gets the completion info for arguments- Parameters:
arguments
- Arguments- Returns:
- Completion data,
null
if none specified
-
getCompletionData
-