Skip to main content

Cli

Struct Cli 

Source
pub struct Cli {
Show 30 fields pub paths: Vec<PathBuf>, pub lines: Vec<String>, pub sections: Vec<String>, pub recursive: bool, pub list_sections: bool, pub force: Option<String>, pub mode: String, pub verbose: bool, pub json: bool, pub temp_suffix: Option<String>, pub encoding: String, pub strict_ext: bool, pub no_dereference: bool, pub eol: String, pub posix_exit: bool, pub comment_style: Vec<String>, pub interactive: bool, pub dry_run: bool, pub backup: Option<String>, pub to_end: bool, pub scan: bool, pub check: bool, pub pair: bool, pub config: Option<PathBuf>, pub atomic: bool, pub no_backup: bool, pub recover: bool, pub recover_forward: bool, pub completions: Option<Shell>, pub man: bool,
}

Fields§

§paths: Vec<PathBuf>

File or directory paths to process

§lines: Vec<String>

Line range in format <start_line>:<end_line> or <start_line>:+ (repeatable)

§sections: Vec<String>

Section ID to toggle. Use group:variant (e.g. db:postgres) for variant ops: -S group flips a 2-variant pair; -S group:variant activates one variant and comments siblings; -S group --force on/off applies to every variant.

§recursive: bool

Recursively walk directories

§list_sections: bool

List all section IDs found in files (discovery mode, no toggling)

§force: Option<String>

Force toggle state (on/off/invert)

§mode: String

Comment mode (auto/single/multi)

§verbose: bool

Human-readable log lines to stderr

§json: bool

Machine-readable single-line JSON to stdout

§temp_suffix: Option<String>

Extension for atomic temp file

§encoding: String

Override file codec (UTF-8 only in Phase 0)

§strict_ext: bool

Error if target is not .py

§no_dereference: bool

Operate on symlink itself instead of target

§eol: String

EOL normalization: preserve, lf, or crlf

§posix_exit: bool

Map exit codes to sysexits.h values

§comment_style: Vec<String>

Override comment style: SINGLE [MULTI_START MULTI_END]

§interactive: bool

Prompt before modifying each file

§dry_run: bool

Show diff of changes without writing files

§backup: Option<String>

Create backup with given extension before modifying (e.g. –backup .bak)

§to_end: bool

Extend the last –line range to the end of file

§scan: bool

Scan for section IDs without modifying files

§check: bool

Validate section integrity without modifying files. Requires –scan.

§pair: bool

Enforce exactly 2 variants in the targeted group; error otherwise. Pre-execution check — no file modifications occur on failure.

§config: Option<PathBuf>

Path to .toggleConfig TOML file

§atomic: bool

Enable atomic multi-file mode: all files succeed or none are modified. Implies –backup unless –no-backup is explicitly passed.

§no_backup: bool

Disable backup creation in atomic mode. Only valid with –atomic. WARNING: Without backups, rollback is not possible if the rename phase fails.

§recover: bool

Recover from an interrupted atomic operation. Default: rollback.

§recover_forward: bool

Complete an interrupted atomic commit instead of rolling back. Must be combined with –recover.

§completions: Option<Shell>

Generate shell completions for the given shell to stdout. Example: toggle --completions bash > /etc/bash_completion.d/toggle

§man: bool

Generate a roff-formatted man page to stdout. Example: toggle --man > toggle.1 && man ./toggle.1

Trait Implementations§

Source§

impl Args for Cli

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

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 more
Source§

impl CommandFactory for Cli

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl FromArgMatches for Cli

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

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>

Assign values from ArgMatches to self.
Source§

impl Parser for Cli

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl Freeze for Cli

§

impl RefUnwindSafe for Cli

§

impl Send for Cli

§

impl Sync for Cli

§

impl Unpin for Cli

§

impl UnsafeUnpin for Cli

§

impl UnwindSafe for Cli

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.