mirror of
https://github.com/atuinsh/atuin.git
synced 2025-06-20 18:07:57 +02: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 dotfiles;
|
||||||
mod history;
|
mod history;
|
||||||
mod import;
|
mod import;
|
||||||
|
mod info;
|
||||||
mod init;
|
mod init;
|
||||||
mod kv;
|
mod kv;
|
||||||
mod search;
|
mod search;
|
||||||
@ -59,6 +60,10 @@ pub enum Cmd {
|
|||||||
#[command()]
|
#[command()]
|
||||||
Init(init::Cmd),
|
Init(init::Cmd),
|
||||||
|
|
||||||
|
/// Information about dotfiles locations and ENV vars
|
||||||
|
#[command()]
|
||||||
|
Info,
|
||||||
|
|
||||||
#[command()]
|
#[command()]
|
||||||
Doctor,
|
Doctor,
|
||||||
|
|
||||||
@ -117,6 +122,11 @@ impl Cmd {
|
|||||||
|
|
||||||
Self::Init(init) => init.run(&settings).await,
|
Self::Init(init) => init.run(&settings).await,
|
||||||
|
|
||||||
|
Self::Info => {
|
||||||
|
info::run(&settings);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
Self::Doctor => doctor::run(&settings),
|
Self::Doctor => doctor::run(&settings),
|
||||||
|
|
||||||
Self::DefaultConfig => {
|
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…
x
Reference in New Issue
Block a user