- java.lang.Object
-
- com.github.rvesse.airline.builder.AbstractBuilder<Cli<C>>
-
- com.github.rvesse.airline.builder.CliBuilder<C>
-
- Type Parameters:
C
- Command type
public class CliBuilder<C> extends AbstractBuilder<Cli<C>>
Builder for CLIs
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,HelpSection>
baseHelpSections
protected java.lang.Class<? extends C>
defaultCommand
protected java.util.List<java.lang.Class<? extends C>>
defaultCommandGroupCommands
protected java.lang.String
description
protected java.util.Map<java.lang.String,GroupBuilder<C>>
groups
protected java.lang.String
name
protected java.lang.String
optionSeparators
protected ParserBuilder<C>
parserBuilder
protected java.util.List<GlobalRestriction>
restrictions
-
Constructor Summary
Constructors Constructor Description CliBuilder(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cli<C>
build()
Builds the typeGroupBuilder<C>
getGroup(java.lang.String name)
CliBuilder<C>
withCommand(java.lang.Class<? extends C> command)
CliBuilder<C>
withCommands(java.lang.Class<? extends C> command, java.lang.Class<? extends C>... moreCommands)
CliBuilder<C>
withCommands(java.lang.Iterable<java.lang.Class<? extends C>> commands)
CliBuilder<C>
withDefaultCommand(java.lang.Class<? extends C> defaultCommand)
CliBuilder<C>
withDefaultRestrictions()
CliBuilder<C>
withDescription(java.lang.String description)
GroupBuilder<C>
withGroup(java.lang.String name)
CliBuilder<C>
withHelpSection(HelpSection section)
CliBuilder<C>
withNoRestrictions()
CliBuilder<C>
withOnlyDefaultRestrictions()
ParserBuilder<C>
withParser()
CliBuilder<C>
withRestriction(GlobalRestriction restriction)
CliBuilder<C>
withRestrictions(GlobalRestriction... restrictions)
-
Methods inherited from class com.github.rvesse.airline.builder.AbstractBuilder
checkNotBlank, checkNotEmpty, checkNotNull
-
-
-
-
Field Detail
-
name
protected final java.lang.String name
-
description
protected java.lang.String description
-
optionSeparators
protected java.lang.String optionSeparators
-
defaultCommand
protected java.lang.Class<? extends C> defaultCommand
-
defaultCommandGroupCommands
protected final java.util.List<java.lang.Class<? extends C>> defaultCommandGroupCommands
-
groups
protected final java.util.Map<java.lang.String,GroupBuilder<C>> groups
-
restrictions
protected final java.util.List<GlobalRestriction> restrictions
-
parserBuilder
protected final ParserBuilder<C> parserBuilder
-
baseHelpSections
protected final java.util.Map<java.lang.String,HelpSection> baseHelpSections
-
-
Method Detail
-
withDescription
public CliBuilder<C> withDescription(java.lang.String description)
-
withDefaultCommand
public CliBuilder<C> withDefaultCommand(java.lang.Class<? extends C> defaultCommand)
-
withCommand
public CliBuilder<C> withCommand(java.lang.Class<? extends C> command)
-
withCommands
public CliBuilder<C> withCommands(java.lang.Class<? extends C> command, java.lang.Class<? extends C>... moreCommands)
-
withCommands
public CliBuilder<C> withCommands(java.lang.Iterable<java.lang.Class<? extends C>> commands)
-
withGroup
public GroupBuilder<C> withGroup(java.lang.String name)
-
getGroup
public GroupBuilder<C> getGroup(java.lang.String name)
-
withRestriction
public CliBuilder<C> withRestriction(GlobalRestriction restriction)
-
withRestrictions
public CliBuilder<C> withRestrictions(GlobalRestriction... restrictions)
-
withNoRestrictions
public CliBuilder<C> withNoRestrictions()
-
withDefaultRestrictions
public CliBuilder<C> withDefaultRestrictions()
-
withOnlyDefaultRestrictions
public CliBuilder<C> withOnlyDefaultRestrictions()
-
withParser
public ParserBuilder<C> withParser()
-
withHelpSection
public CliBuilder<C> withHelpSection(HelpSection section)
-
build
public Cli<C> build()
Description copied from class:AbstractBuilder
Builds the type- Specified by:
build
in classAbstractBuilder<Cli<C>>
- Returns:
- Type instance
-
-