pub struct Command {
    pub name: String,
    pub args: Vec<Argument>,
    pub subcommands: Vec<Command>,
}
Expand description

Possible (sub)command displayed in tab completion.

The arguments right from a (sub)command may be flags, arbitrary arguments or even subcommands. They all can be displayed or even tab-completed, when described in this data structure’s attributes.

use shli::Command;

let cmd = Command::new("exit");

Fields

name: String

The name of the command that shall be completed

args: Vec<Argument>

If calling completion after the name, the arguments may be completed

subcommands: Vec<Command>

If calling completion after a subcommand, it may be completed

Implementations

Create a new instance by specifying the command’s name

Add a subcommand to this command

use shli::Command;

let cmd = Command::new("config")
    .subcommand(Command::new("commit"));

Add a concrete argument (e.g. a flag) to this command

use shli::Command;

let cmd = Command::new("config").arg("--help");

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.