diff options
| author | Tobias Genannt <tobias.genannt@gmail.com> | 2023-10-12 23:13:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-12 22:13:50 +0100 |
| commit | 20afcd2b633791c932651e04e340334dabb3ed4e (patch) | |
| tree | 9e9e6a4d0dcd117bf94c943863578553e54d1223 /atuin-client/src | |
| parent | Update key-binding.md (#1291) (diff) | |
| download | atuin-20afcd2b633791c932651e04e340334dabb3ed4e.zip | |
Add commands to print the default configuration (#1241)
* Add commands to print the default configuration
When updating a software I often want to compare my configuration with the
configuration of the new version. To make this possible atuin can now print
the default configuration.
This also updates the example files with the actual values used as default in
the settings.rs files.
* Changed command name to 'default-config'
* Fixed merge
Diffstat (limited to 'atuin-client/src')
| -rw-r--r-- | atuin-client/src/settings.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index e49ab0cb..15aa9e06 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -24,6 +24,7 @@ pub const LAST_SYNC_FILENAME: &str = "last_sync_time"; pub const LAST_VERSION_CHECK_FILENAME: &str = "last_version_check_time"; pub const LATEST_VERSION_FILENAME: &str = "latest_version"; pub const HOST_ID_FILENAME: &str = "host_id"; +static EXAMPLE_CONFIG: &str = include_str!("../config.toml"); #[derive(Clone, Debug, Deserialize, Copy, ValueEnum, PartialEq)] pub enum SearchMode { @@ -410,9 +411,8 @@ impl Settings { FileFormat::Toml, )) } else { - let example_config = include_bytes!("../config.toml"); let mut file = File::create(config_file).wrap_err("could not create config file")?; - file.write_all(example_config) + file.write_all(EXAMPLE_CONFIG.as_bytes()) .wrap_err("could not write default config file")?; config_builder @@ -446,6 +446,10 @@ impl Settings { Ok(settings) } + + pub fn example_config() -> &'static str { + EXAMPLE_CONFIG + } } impl Default for Settings { |
