CommandSpec describes the specification of a parent or leaf command. Each command has the following attributes:
class ref CommandSpec
Creates a command spec that can accept options and child commands, but not arguments.
new ref parent( name': String val, descr': String val = "", options': Array[OptionSpec val] box = call, commands': Array[CommandSpec ref] box = call) : CommandSpec ref^ ?
Creates a command spec that can accept options and arguments, but not child commands.
new ref leaf( name': String val, descr': String val = "", options': Array[OptionSpec val] box = call, args': Array[ArgSpec val] box = call) : CommandSpec ref^ ?
Adds an additional child command to this parent command.
fun ref add_command( cmd: CommandSpec box) : None val ?
Adds a standard help option and, optionally command, to a root command.
fun ref add_help( hname: String val = "help", descr': String val = "") : None val ?
Returns the name of this command.
fun box name() : String val
Returns the description for this command.
fun box descr() : String val
Returns a map by name of the named options of this command.
fun box options() : HashMap[String val, OptionSpec val, HashEq[String val] val] box
Returns a map by name of the child commands of this command.
fun box commands() : HashMap[String val, CommandSpec box, HashEq[String val] val] box
Returns an array of the positional arguments of this command.
fun box args() : Array[ArgSpec val] box
fun box is_leaf() : Bool val
fun box is_parent() : Bool val
Returns the name of the help command, which defaults to "help".
fun box help_name() : String val
Returns a formated help string for this command and all of its arguments.
fun box help_string() : String val
fun tag _assertName( nm: String val) : String val ?
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/cli-CommandSpec