mirror of
https://github.com/atuinsh/atuin.git
synced 2024-11-22 08:13:57 +01:00
feat: adds info command to show env vars and config files (#1841)
* feat: adds info command to show env vars and config files * fix: clippy * refactor: clippy and format again
This commit is contained in:
parent
a3c3dad900
commit
ba0fe21795
@ -17,6 +17,7 @@ mod doctor;
|
||||
mod dotfiles;
|
||||
mod history;
|
||||
mod import;
|
||||
mod info;
|
||||
mod init;
|
||||
mod kv;
|
||||
mod search;
|
||||
@ -59,6 +60,10 @@ pub enum Cmd {
|
||||
#[command()]
|
||||
Init(init::Cmd),
|
||||
|
||||
/// Information about dotfiles locations and ENV vars
|
||||
#[command()]
|
||||
Info,
|
||||
|
||||
#[command()]
|
||||
Doctor,
|
||||
|
||||
@ -117,6 +122,11 @@ impl Cmd {
|
||||
|
||||
Self::Init(init) => init.run(&settings).await,
|
||||
|
||||
Self::Info => {
|
||||
info::run(&settings);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Self::Doctor => doctor::run(&settings),
|
||||
|
||||
Self::DefaultConfig => {
|
||||
|
31
atuin/src/command/client/info.rs
Normal file
31
atuin/src/command/client/info.rs
Normal file
@ -0,0 +1,31 @@
|
||||
use atuin_client::settings::Settings;
|
||||
|
||||
use crate::VERSION;
|
||||
|
||||
pub fn run(settings: &Settings) {
|
||||
let config = atuin_common::utils::config_dir();
|
||||
let mut config_file = config.clone();
|
||||
config_file.push("config.toml");
|
||||
let mut sever_config = config;
|
||||
sever_config.push("server.toml");
|
||||
|
||||
let config_paths = format!(
|
||||
"Config files:\nclient config: {:?}\nserver config: {:?}\nclient db path: {:?}\nkey path: {:?}\nsession path: {:?}",
|
||||
config_file.to_string_lossy(),
|
||||
sever_config.to_string_lossy(),
|
||||
settings.db_path,
|
||||
settings.key_path,
|
||||
settings.session_path
|
||||
);
|
||||
|
||||
let env_vars = format!(
|
||||
"Env Vars:\nATUIN_CONFIG_DIR = {:?}",
|
||||
std::env::var("ATUIN_CONFIG_DIR").unwrap_or_else(|_| "None".into())
|
||||
);
|
||||
|
||||
let general_info = format!("Version info:\nversion: {VERSION}");
|
||||
|
||||
let print_out = format!("{config_paths}\n\n{env_vars}\n\n{general_info}");
|
||||
|
||||
println!("{print_out}");
|
||||
}
|
Loading…
Reference in New Issue
Block a user