Command Reference

protocol EasyCommand : Command

Implement this to create a command easily.

var name : String

The name of your command

var options : [Option]

The options your command supports

var shortHelp : String

A short, one-line help string that describes what your command does.

var requiresCommandString : Bool

Setting this to false indicates the command string is not required to be present. This may be useful if the EasyCommand is at the top of the parse hierarchy.

extension EasyCommand
var requiresCommandString : Bool
extension EasyCommand
var parser : Parser
protocol EasyCommand : Command

Implement this to create a command easily.

var name : String

The name of your command

var options : [Option]

The options your command supports

var shortHelp : String

A short, one-line help string that describes what your command does.

var requiresCommandString : Bool

Setting this to false indicates the command string is not required to be present. This may be useful if the EasyCommand is at the top of the parse hierarchy.

extension EasyCommand
var requiresCommandString : Bool
extension EasyCommand
var parser : Parser
protocol Command

The command protocol.

Note:You probably don’t want to implement this directly; instead consider implementing EasyCommand.
var parser : Parser

The command’s parser. Ordinarily this is a CommandParser .

func command(_: ParseResult)

A function to run when the command is selected.

Parameters:
  • parseResult – The result we parsed for this command
var name : String
var aliases : [String]

Additional aliases for the given command. Override this to specify alternatives.

extension Command
var aliases : [String]
class MetaCommand : Command, Parser

A command that picks exactly one of several subcommands. This is ordinarily the top-level command for most programs.

Note:A command called “legal” is automatically added to MetaCommand s. The “legal” command displays NOTICE or LICENSE files for the bundle or any frameworks for the executable.
Note:A version command is automatically added to MetaCommand s.
let name : String
var parser : Parser
init(name: String, version: String, subcommands: [Command])
func _parse(_: [String])throws → ParseResult
func underlyingParser(_: [String]) → Parser
func command(_: ParseResult)
var shortHelp : String
var longHelp : String