pub struct Config { /* private fields */ }Expand description
An object to configure how the code-gen should work e.g. to ignore some certain flags or subcommands.
let config: Config = Default::default();
let mut cmd = clap::Command::new("git");
generate(&mut cmd, config, &mut std::io::stdout()).unwrap();Implementations§
Source§impl Config
impl Config
pub fn new() -> Self
Sourcepub fn ignore(self, ids: &[&str]) -> Self
pub fn ignore(self, ids: &[&str]) -> Self
Ignore a certain flag or subcommand during code-gen.
Note that if you want to ignore something that doesn’t actually exist in the command definition,
The generate function will raise an UnprocessedConfigObj error.
let config = Config::default()
.ignore(&["log", "pretty"]) // ignore the `git log --pretty` flag
.ignore(&["branch"]) // ignore the `git branch` command
.ignore(&["unexpected-thing"]); // will cause error during code-genpub fn strict(self, yes: bool) -> Self
pub fn is_strict(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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