meli: add print-used-paths subcommand

Print all paths that meli creates/uses e.g. XDG data path and temp dir
path.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/299/head
Manos Pitsidianakis 8 months ago
parent 9b9c38f769
commit 747e39bf55
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -79,6 +79,8 @@ Print documentation page and exit (Piping to a pager is recommended).
Print default theme keys and values in TOML syntax, to be used as a blueprint.
.It Cm print-loaded-themes
Print all loaded themes in TOML syntax.
.It Cm print-used-paths
Print all paths that meli creates/uses.
.It Cm compiled-with
Print compile time feature flags of this binary.
.It Cm view

@ -65,6 +65,8 @@ pub enum SubCommand {
PrintDefaultTheme,
/// print loaded themes in full to stdout and exit.
PrintLoadedThemes,
/// print all paths that meli creates/uses.
PrintUsedPaths,
/// edit configuration files with `$EDITOR`/`$VISUAL`.
EditConfig,
/// create a sample configuration file with available configuration options.

@ -117,6 +117,22 @@ fn run_app(opt: Opt) -> Result<()> {
return Ok(());
}
Some(SubCommand::View { .. }) => {}
Some(SubCommand::PrintUsedPaths) => {
println!(
"{}",
xdg::BaseDirectories::with_prefix("meli")
.expect(
"Could not find your XDG directories. If this is unexpected, please \
report it as a bug."
)
.get_data_file("")
.display()
);
let mut temp_dir = std::env::temp_dir();
temp_dir.push("meli");
println!("{}", temp_dir.display());
return Ok(());
}
None => {}
}

Loading…
Cancel
Save