pub struct CommandSpec {
pub name: String,
pub about: String,
pub version: Option<String>,
pub author: Option<String>,
pub args: Vec<ArgSpec>,
pub subcommands: Vec<CommandSpec>,
}Expand description
Command specification returned by plugin’s manifest() function
Fields§
§name: StringCommand name (used for routing, e.g., “hello” or “db:create”)
about: StringShort description for help text
version: Option<String>Plugin version (semver)
Plugin author
args: Vec<ArgSpec>Argument specifications
subcommands: Vec<CommandSpec>Nested subcommands
Implementations§
Source§impl CommandSpec
impl CommandSpec
Sourcepub fn new(name: impl Into<String>, about: impl Into<String>) -> CommandSpec
pub fn new(name: impl Into<String>, about: impl Into<String>) -> CommandSpec
Create a new command spec
Sourcepub fn version(self, version: impl Into<String>) -> CommandSpec
pub fn version(self, version: impl Into<String>) -> CommandSpec
Add version
Sourcepub fn arg(self, arg: ArgSpec) -> CommandSpec
pub fn arg(self, arg: ArgSpec) -> CommandSpec
Add an argument
Sourcepub fn subcommand(self, cmd: CommandSpec) -> CommandSpec
pub fn subcommand(self, cmd: CommandSpec) -> CommandSpec
Add a subcommand
Trait Implementations§
Source§impl Clone for CommandSpec
impl Clone for CommandSpec
Source§fn clone(&self) -> CommandSpec
fn clone(&self) -> CommandSpec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandSpec
impl Debug for CommandSpec
Source§impl<'de> Deserialize<'de> for CommandSpec
impl<'de> Deserialize<'de> for CommandSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CommandSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CommandSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for CommandSpec
impl Serialize for CommandSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for CommandSpec
impl RefUnwindSafe for CommandSpec
impl Send for CommandSpec
impl Sync for CommandSpec
impl Unpin for CommandSpec
impl UnwindSafe for CommandSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more