Show the configuration file's location in sq config --help.

- Include the location of the configuration file in `sq config
    --help`.

  - See #470.
This commit is contained in:
Neal H. Walfield 2024-11-30 10:00:32 +01:00
parent de9c5f48b0
commit 84a8807173
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3

View File

@ -93,6 +93,8 @@ Get configuration options
This subcommand can be used to inspect the configuration \
file{}, and to create a template that can be edited to your liking.
Configuration file: {}
",
sequoia_directories::Home::default()
.map(|home| {
@ -108,6 +110,20 @@ file{}, and to create a template that can be edited to your liking.
}
format!(" (default location: {})", p)
})
.unwrap_or("".to_string()),
find_home()
.map(|home| {
let p = home.config_dir(sequoia_directories::Component::Sq);
let p = p.join("config.toml");
let p = p.display().to_string();
if let Some(home) = dirs::home_dir() {
let home = home.display().to_string();
if let Some(rest) = p.strip_prefix(&home) {
return format!("$HOME{}", rest);
}
}
p
})
.unwrap_or("".to_string())),
subcommand_required = true,
arg_required_else_help = true,