pub struct DevcontextArgs {
pub repo: RepoArgs,
pub command: DevcontextCommand,
pub format: OutputFormat,
}Expand description
majordomus devcontext. Every subcommand is the projection of one devcontext.*
capability; the request flags are declared once and shared by compile and explain.
--format is global, so it parses where a person writes it rather than only before
the subcommand, and the group itself runs nothing: every runnable path here is a
capability’s.
use clap::Parser;
use majordomus_cli::cli::{Cli, Command, DevcontextArgs, DevcontextCommand, OutputFormat};
let cli = Cli::try_parse_from([
"majordomus", "devcontext", "compile", "--intent", "explain the budget",
"--budget-tokens", "4000", "--format", "json",
])
.unwrap();
let args: DevcontextArgs = match cli.command {
Command::Devcontext(args) => args,
other => panic!("expected `devcontext`, parsed {other:?}"),
};
// written after the subcommand and picked up all the same
assert!(matches!(args.format, OutputFormat::Json));
let DevcontextCommand::Compile(request) = args.command else { panic!("compile") };
assert_eq!(request.intent.as_deref(), Some("explain the budget"));
assert_eq!(request.budget_tokens, Some(4000));
// the group has no behaviour of its own, so it refuses to be run bare
assert!(Cli::try_parse_from(["majordomus", "devcontext"]).is_err());Fields§
§repo: RepoArgsWhere and how the repository is read.
command: DevcontextCommandcompile, explain or policy.
format: OutputFormatOutput shape
Trait Implementations§
Source§impl Args for DevcontextArgs
impl Args for DevcontextArgs
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
Report the [
ArgGroup::id][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Append to [
Command] so it can instantiate self via
[FromArgMatches::update_from_arg_matches_mut] Read moreSource§impl Debug for DevcontextArgs
impl Debug for DevcontextArgs
Source§impl FromArgMatches for DevcontextArgs
impl FromArgMatches for DevcontextArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Auto Trait Implementations§
impl Freeze for DevcontextArgs
impl RefUnwindSafe for DevcontextArgs
impl Send for DevcontextArgs
impl Sync for DevcontextArgs
impl Unpin for DevcontextArgs
impl UnsafeUnpin for DevcontextArgs
impl UnwindSafe for DevcontextArgs
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