- java.lang.Object
-
- org.apache.bookkeeper.tools.framework.CliCommand<GlobalFlagsT,CommandFlagsT>
-
- All Implemented Interfaces:
Command<GlobalFlagsT>
- Direct Known Subclasses:
BKCommand
,CliCommandGroup
public class CliCommand<GlobalFlagsT extends CliFlags,CommandFlagsT extends CliFlags> extends java.lang.Object implements Command<GlobalFlagsT>
A command that runs a CLI spec. it is typically used for nested sub commands.
-
-
Field Summary
Fields Modifier and Type Field Description protected CliSpec<CommandFlagsT>
spec
-
Constructor Summary
Constructors Constructor Description CliCommand(CliSpec<CommandFlagsT> spec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
apply(GlobalFlagsT globalFlags, java.lang.String[] args)
Process the command.java.lang.String
category()
Return category of this command belongs to.java.lang.String
description()
Return description name.java.lang.String
getUsage()
java.lang.String
name()
Return command name.java.lang.String
path()
Return command path in a cli path.void
setParent(java.lang.String parent)
void
usage()
Print the help information.
-
-
-
Field Detail
-
spec
protected CliSpec<CommandFlagsT extends CliFlags> spec
-
-
Constructor Detail
-
CliCommand
public CliCommand(CliSpec<CommandFlagsT> spec)
-
-
Method Detail
-
setParent
public void setParent(java.lang.String parent)
-
category
public java.lang.String category()
Description copied from interface:Command
Return category of this command belongs to.- Specified by:
category
in interfaceCommand<GlobalFlagsT extends CliFlags>
- Returns:
- category name
-
name
public java.lang.String name()
Description copied from interface:Command
Return command name.- Specified by:
name
in interfaceCommand<GlobalFlagsT extends CliFlags>
- Returns:
- command name.
-
path
public java.lang.String path()
Description copied from interface:Command
Return command path in a cli path.This is used for printing usage information.
- Specified by:
path
in interfaceCommand<GlobalFlagsT extends CliFlags>
- Returns:
- command path
-
description
public java.lang.String description()
Description copied from interface:Command
Return description name.- Specified by:
description
in interfaceCommand<GlobalFlagsT extends CliFlags>
- Returns:
- description name.
-
apply
public java.lang.Boolean apply(GlobalFlagsT globalFlags, java.lang.String[] args)
Description copied from interface:Command
Process the command.- Specified by:
apply
in interfaceCommand<GlobalFlagsT extends CliFlags>
args
- command args- Returns:
- true if successfully apply the args, otherwise false
-
usage
public void usage()
Description copied from interface:Command
Print the help information.- Specified by:
usage
in interfaceCommand<GlobalFlagsT extends CliFlags>
-
getUsage
public java.lang.String getUsage()
-
-