pub enum ConfigAction {
Set {
key: String,
value: String,
},
Get {
key: String,
},
List,
Reset,
}
Expand description
Configuration management operations and subcommands.
Defines the available configuration management operations that can be performed through the SubX CLI. Each operation provides specific functionality for different aspects of configuration management.
§Operation Categories
- Viewing: Get and list operations for inspecting settings
- Modification: Set operation for changing configuration values
- Maintenance: Reset operation for restoring defaults
§Validation and Safety
All configuration operations include:
- Type validation: Ensure values match expected data types
- Range checking: Validate numeric values are within acceptable ranges
- Format verification: Check string values follow required patterns
- Dependency checking: Verify related settings are compatible
§Examples
use subx_cli::cli::ConfigAction;
// Different configuration operations
let set_provider = ConfigAction::Set {
key: "ai.provider".to_string(),
value: "openai".to_string(),
};
let get_provider = ConfigAction::Get {
key: "ai.provider".to_string(),
};
let list_all = ConfigAction::List;
let reset_config = ConfigAction::Reset;
Variants§
Set
Set a configuration value with validation and type checking
Fields
Get
Retrieve and display a specific configuration value
List
List all configuration settings with their current values
Reset
Reset configuration to default values with backup creation
Trait Implementations§
Source§impl Debug for ConfigAction
impl Debug for ConfigAction
Source§impl FromArgMatches for ConfigAction
impl FromArgMatches for ConfigAction
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<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches
to self
.Source§impl Subcommand for ConfigAction
impl Subcommand for ConfigAction
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Append to
Command
so it can instantiate self
via
FromArgMatches::update_from_arg_matches_mut
Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Test whether
Self
can parse a specific subcommandAuto Trait Implementations§
impl Freeze for ConfigAction
impl RefUnwindSafe for ConfigAction
impl Send for ConfigAction
impl Sync for ConfigAction
impl Unpin for ConfigAction
impl UnwindSafe for ConfigAction
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