pub struct Config {Show 34 fields
pub api_key: Option<String>,
pub api_url: Option<String>,
pub ai_provider: Option<String>,
pub model: Option<String>,
pub tokens_max_input: Option<usize>,
pub tokens_max_output: Option<u32>,
pub commit_type: Option<String>,
pub emoji: Option<bool>,
pub description: Option<bool>,
pub description_capitalize: Option<bool>,
pub description_add_period: Option<bool>,
pub description_max_length: Option<usize>,
pub language: Option<String>,
pub message_template_placeholder: Option<String>,
pub prompt_module: Option<String>,
pub gitpush: Option<bool>,
pub one_line_commit: Option<bool>,
pub why: Option<bool>,
pub omit_scope: Option<bool>,
pub generate_count: Option<u8>,
pub clipboard_on_timeout: Option<bool>,
pub action_enabled: Option<bool>,
pub test_mock_type: Option<String>,
pub hook_auto_uncomment: Option<bool>,
pub pre_gen_hook: Option<Vec<String>>,
pub pre_commit_hook: Option<Vec<String>>,
pub post_commit_hook: Option<Vec<String>>,
pub hook_strict: Option<bool>,
pub hook_timeout_ms: Option<u64>,
pub commitlint_config: Option<String>,
pub custom_prompt: Option<String>,
pub learn_from_history: Option<bool>,
pub history_commits_count: Option<usize>,
pub style_profile: Option<String>,
}Fields§
§api_key: Option<String>§api_url: Option<String>§ai_provider: Option<String>§model: Option<String>§tokens_max_input: Option<usize>§tokens_max_output: Option<u32>§commit_type: Option<String>§emoji: Option<bool>§description: Option<bool>§description_capitalize: Option<bool>§description_add_period: Option<bool>§description_max_length: Option<usize>§language: Option<String>§message_template_placeholder: Option<String>§prompt_module: Option<String>§gitpush: Option<bool>§one_line_commit: Option<bool>§why: Option<bool>§omit_scope: Option<bool>§generate_count: Option<u8>§clipboard_on_timeout: Option<bool>§action_enabled: Option<bool>§test_mock_type: Option<String>§hook_auto_uncomment: Option<bool>§pre_gen_hook: Option<Vec<String>>§pre_commit_hook: Option<Vec<String>>§post_commit_hook: Option<Vec<String>>§hook_strict: Option<bool>§hook_timeout_ms: Option<u64>§commitlint_config: Option<String>§custom_prompt: Option<String>§learn_from_history: Option<bool>§history_commits_count: Option<usize>§style_profile: Option<String>Implementations§
Source§impl Config
impl Config
Sourcepub fn global_config_path() -> Result<PathBuf>
pub fn global_config_path() -> Result<PathBuf>
Get the new global config path
pub fn save(&self) -> Result<()>
Sourcepub fn save_to(&self, location: ConfigLocation) -> Result<()>
pub fn save_to(&self, location: ConfigLocation) -> Result<()>
Save configuration to a specific location
pub fn set(&mut self, key: &str, value: &str) -> Result<()>
pub fn get(&self, key: &str) -> Result<String>
pub fn reset(&mut self, keys: Option<&[String]>) -> Result<()>
Sourcepub fn load_with_commitlint(&mut self) -> Result<()>
pub fn load_with_commitlint(&mut self) -> Result<()>
Load and merge global commitlint configuration
Sourcepub fn apply_commitlint_rules(&mut self) -> Result<()>
pub fn apply_commitlint_rules(&mut self) -> Result<()>
Load commitlint rules and modify commit type accordingly
Sourcepub fn get_effective_prompt(
&self,
diff: &str,
context: Option<&str>,
full_gitmoji: bool,
) -> String
pub fn get_effective_prompt( &self, diff: &str, context: Option<&str>, full_gitmoji: bool, ) -> String
Get the effective prompt (custom or generated)
Sourcepub fn merge(&mut self, other: Config)
pub fn merge(&mut self, other: Config)
Merge another config into this one (other takes priority over self)
Sourcepub fn load_from_environment(&mut self)
pub fn load_from_environment(&mut self)
Load configuration values from environment variables Uses RCO_ environment variables
Source§impl Config
impl Config
Sourcepub fn get_active_account(&self) -> Result<Option<AccountConfig>>
pub fn get_active_account(&self) -> Result<Option<AccountConfig>>
Get the active account config, if available
Sourcepub fn has_accounts(&self) -> bool
pub fn has_accounts(&self) -> bool
Check if we have any accounts configured
Sourcepub fn get_account(&self, alias: &str) -> Result<Option<AccountConfig>>
pub fn get_account(&self, alias: &str) -> Result<Option<AccountConfig>>
Get a specific account by alias
Sourcepub fn list_accounts(&self) -> Result<Vec<AccountConfig>>
pub fn list_accounts(&self) -> Result<Vec<AccountConfig>>
List all accounts
Sourcepub fn set_default_account(&mut self, alias: &str) -> Result<()>
pub fn set_default_account(&mut self, alias: &str) -> Result<()>
Set an account as the default (active) account
Sourcepub fn remove_account(&mut self, alias: &str) -> Result<()>
pub fn remove_account(&mut self, alias: &str) -> Result<()>
Remove an account
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.