Skip to main content

Config

Struct Config 

Source
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

Source

pub fn global_config_path() -> Result<PathBuf>

Get the new global config path

Source

pub fn load() -> Result<Self>

Load configuration with proper priority handling

Source

pub fn save(&self) -> Result<()>

Source

pub fn save_to(&self, location: ConfigLocation) -> Result<()>

Save configuration to a specific location

Source

pub fn set(&mut self, key: &str, value: &str) -> Result<()>

Source

pub fn get(&self, key: &str) -> Result<String>

Source

pub fn reset(&mut self, keys: Option<&[String]>) -> Result<()>

Source

pub fn load_with_commitlint(&mut self) -> Result<()>

Load and merge global commitlint configuration

Source

pub fn apply_commitlint_rules(&mut self) -> Result<()>

Load commitlint rules and modify commit type accordingly

Source

pub fn get_effective_prompt( &self, diff: &str, context: Option<&str>, full_gitmoji: bool, ) -> String

Get the effective prompt (custom or generated)

Source

pub fn merge(&mut self, other: Config)

Merge another config into this one (other takes priority over self)

Source

pub fn load_from_environment(&mut self)

Load configuration values from environment variables Uses RCO_ environment variables

Source§

impl Config

Source

pub fn get_active_account(&self) -> Result<Option<AccountConfig>>

Get the active account config, if available

Source

pub fn has_accounts(&self) -> bool

Check if we have any accounts configured

Source

pub fn get_account(&self, alias: &str) -> Result<Option<AccountConfig>>

Get a specific account by alias

Source

pub fn list_accounts(&self) -> Result<Vec<AccountConfig>>

List all accounts

Source

pub fn set_default_account(&mut self, alias: &str) -> Result<()>

Set an account as the default (active) account

Source

pub fn remove_account(&mut self, alias: &str) -> Result<()>

Remove an account

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,