pub struct Operation<Handler, Inputs = (), Mode = Total> { /* private fields */ }Expand description
Carries a typed operation, the sources of its arguments (one per argument, in order), and how its output is read as the command’s outcome.
Implementations§
Source§impl<Handler, Inputs, Mode> Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> Operation<Handler, Inputs, Mode>
Sourcepub fn arg<Source>(
self,
name: &'static str,
source: Source,
) -> Operation<Handler, (Inputs, Source), Mode>
pub fn arg<Source>( self, name: &'static str, source: Source, ) -> Operation<Handler, (Inputs, Source), Mode>
Declares the source of the operation’s next argument, the one named name, after those
already declared.
defunc(via = cli) checks the name against the operation’s own when the program compiles,
reporting a source written for another argument where it is written.
Sourcepub fn declare(self, name: &'static str) -> Command<Handler, Inputs, Mode>
pub fn declare(self, name: &'static str) -> Command<Handler, Inputs, Mode>
Declares this operation under one command name, with no program around it.
A program that states many commands composes their registrations rather than their types,
so it needs each command on its own. CliProgram::cmd states the same thing inside a
composition, and is what an author writes.
Source§impl<Handler, Inputs, Mode> Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> Operation<Handler, Inputs, Mode>
Sourcepub fn options_first(self) -> Self
pub fn options_first(self) -> Self
Ends the command’s options at its first operand.
Sourcepub fn unknown_options_as_operands(self) -> Self
pub fn unknown_options_as_operands(self) -> Self
Reads a word naming no option of the command as an operand.
Sourcepub fn no_end_of_options(self) -> Self
pub fn no_end_of_options(self) -> Self
Reads -- as an operand rather than the end of the options.
Sourcepub fn numeric_option(self, long: &'static str) -> Self
pub fn numeric_option(self, long: &'static str) -> Self
Reads a word of a dash and digits as the option spelled --long given those digits, as
head -5 is head -n 5.
Sourcepub fn verbatim(self) -> Self
pub fn verbatim(self) -> Self
Reads every word as an operand, ignores operands beyond the command’s own, and answers no help.
Sourcepub fn within<Program>(
self,
program: CliProgram<Program>,
) -> Within<Handler, Inputs, Mode, Program>
pub fn within<Program>( self, program: CliProgram<Program>, ) -> Within<Handler, Inputs, Mode, Program>
Applies every command of program to the context this operation answers, with no program
around it.
Trait Implementations§
Auto Trait Implementations§
impl<Handler, Inputs, Mode> Freeze for Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> RefUnwindSafe for Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> Send for Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> Sync for Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> Unpin for Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> UnsafeUnpin for Operation<Handler, Inputs, Mode>
impl<Handler, Inputs, Mode> UnwindSafe for Operation<Handler, Inputs, Mode>
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
Source§impl<This> CliDeclarationLawsExt<This> for This
impl<This> CliDeclarationLawsExt<This> for This
Source§fn law_cli_declaration<Operation, Sources, Mode, Commands>(
&self,
name: &'static str,
operation: Operation,
sources: Sources,
mode: Mode,
conventions: Conventions,
) -> Result<(), &'static str>where
This: CliOperationAlg<Operation, Sources, Mode, Commands = Commands> + CliCommandsObserved<Commands = Commands>,
Operation: OperationAlg,
Sources: CliSources<<Operation as OperationAlg>::Args>,
fn law_cli_declaration<Operation, Sources, Mode, Commands>(
&self,
name: &'static str,
operation: Operation,
sources: Sources,
mode: Mode,
conventions: Conventions,
) -> Result<(), &'static str>where
This: CliOperationAlg<Operation, Sources, Mode, Commands = Commands> + CliCommandsObserved<Commands = Commands>,
Operation: OperationAlg,
Sources: CliSources<<Operation as OperationAlg>::Args>,
Checks that operation declared under name with sources describes exactly that, with
one argument per operation argument, in order, and distinct spellings and positions.
Source§impl<This> CliOutcomeLawsExt<This> for This
impl<This> CliOutcomeLawsExt<This> for This
Source§impl<Source> CliPartsFor<ContextArg> for Source
impl<Source> CliPartsFor<ContextArg> for Source
Source§impl<This> CliProgramExt<This> for This
impl<This> CliProgramExt<This> for This
Source§fn compile_cli<Program>(
&self,
program: Program,
) -> <Program as CliProgramAlg<This>>::Commandswhere
Program: CliProgramAlg<This>,
fn compile_cli<Program>(
&self,
program: Program,
) -> <Program as CliProgramAlg<This>>::Commandswhere
Program: CliProgramAlg<This>,
Compiles a named CLI program with this interpreter.
impl<Source> CliStatedFor<ContextArg> for Source
Source§impl<This> ShapeProgramExt<This> for This
impl<This> ShapeProgramExt<This> for This
Source§fn compile_shape<Program>(
&self,
program: Program,
) -> <Program as ShapeProgramAlg<This>>::Tywhere
Program: ShapeProgramAlg<This>,
fn compile_shape<Program>(
&self,
program: Program,
) -> <Program as ShapeProgramAlg<This>>::Tywhere
Program: ShapeProgramAlg<This>,
Folds a declaration with this interpretation.