- 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.Booleanapply(GlobalFlagsT globalFlags, java.lang.String[] args)Process the command.java.lang.Stringcategory()Return category of this command belongs to.java.lang.Stringdescription()Return description name.java.lang.StringgetUsage()java.lang.Stringname()Return command name.java.lang.Stringpath()Return command path in a cli path.voidsetParent(java.lang.String parent)voidusage()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:CommandReturn category of this command belongs to.- Specified by:
categoryin interfaceCommand<GlobalFlagsT extends CliFlags>- Returns:
- category name
-
name
public java.lang.String name()
Description copied from interface:CommandReturn command name.- Specified by:
namein interfaceCommand<GlobalFlagsT extends CliFlags>- Returns:
- command name.
-
path
public java.lang.String path()
Description copied from interface:CommandReturn command path in a cli path.This is used for printing usage information.
- Specified by:
pathin interfaceCommand<GlobalFlagsT extends CliFlags>- Returns:
- command path
-
description
public java.lang.String description()
Description copied from interface:CommandReturn description name.- Specified by:
descriptionin interfaceCommand<GlobalFlagsT extends CliFlags>- Returns:
- description name.
-
apply
public java.lang.Boolean apply(GlobalFlagsT globalFlags, java.lang.String[] args)
Description copied from interface:CommandProcess the command.- Specified by:
applyin interfaceCommand<GlobalFlagsT extends CliFlags>args- command args- Returns:
- true if successfully apply the args, otherwise false
-
usage
public void usage()
Description copied from interface:CommandPrint the help information.- Specified by:
usagein interfaceCommand<GlobalFlagsT extends CliFlags>
-
getUsage
public java.lang.String getUsage()
-
-