diff options
| author | Ellie Huxtable <ellie@elliehuxtable.com> | 2022-12-16 18:37:45 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-16 18:37:45 +0000 |
| commit | 4c6a287f4d18161ed263bb37905edb2566f81245 (patch) | |
| tree | 741c34c6fd700788b4d7b29a1b44a95d77cd9819 /src/command/client | |
| parent | Fix session history (#620) (diff) | |
| download | atuin-4c6a287f4d18161ed263bb37905edb2566f81245.zip | |
Switch to using ATUIN_LOG instead of RUST_LOG (#642)
* Switch to using ATUIN_LOG instead of RUST_LOG
* Stop clippy complaining
* I should know better - clippy is never happy :(
Diffstat (limited to '')
| -rw-r--r-- | src/command/client.rs | 6 | ||||
| -rw-r--r-- | src/command/client/history.rs | 4 | ||||
| -rw-r--r-- | src/command/client/import.rs | 2 | ||||
| -rw-r--r-- | src/command/client/search.rs | 2 | ||||
| -rw-r--r-- | src/command/client/search/duration.rs | 2 | ||||
| -rw-r--r-- | src/command/client/search/event.rs | 2 | ||||
| -rw-r--r-- | src/command/client/search/interactive.rs | 2 | ||||
| -rw-r--r-- | src/command/client/sync.rs | 2 | ||||
| -rw-r--r-- | src/command/client/sync/login.rs | 2 |
9 files changed, 14 insertions, 10 deletions
diff --git a/src/command/client.rs b/src/command/client.rs index f7b9d6fb..df74ac52 100644 --- a/src/command/client.rs +++ b/src/command/client.rs @@ -4,6 +4,7 @@ use clap::Subcommand; use eyre::{Result, WrapErr}; use atuin_client::{database::Sqlite, settings::Settings}; +use env_logger::Builder; #[cfg(feature = "sync")] mod sync; @@ -38,7 +39,10 @@ pub enum Cmd { impl Cmd { #[tokio::main(flavor = "current_thread")] pub async fn run(self) -> Result<()> { - pretty_env_logger::init(); + Builder::new() + .filter_level(log::LevelFilter::Off) + .parse_env("ATUIN_LOG") + .init(); let settings = Settings::new().wrap_err("could not load client settings")?; diff --git a/src/command/client/history.rs b/src/command/client/history.rs index 5c3f1726..19a3df0e 100644 --- a/src/command/client/history.rs +++ b/src/command/client/history.rs @@ -202,11 +202,11 @@ impl Cmd { let history = match (session, cwd) { (None, None) => db.list(settings.filter_mode, &context, None, false).await?, (None, Some(cwd)) => { - let query = format!("select * from history where cwd = '{}';", cwd); + let query = format!("select * from history where cwd = '{cwd}';"); db.query_history(&query).await? } (Some(session), None) => { - let query = format!("select * from history where session = '{}';", session); + let query = format!("select * from history where session = '{session}';"); db.query_history(&query).await? } (Some(session), Some(cwd)) => { diff --git a/src/command/client/import.rs b/src/command/client/import.rs index b0375acd..f14598f2 100644 --- a/src/command/client/import.rs +++ b/src/command/client/import.rs @@ -64,7 +64,7 @@ impl Cmd { println!("Detected Bash"); import::<Bash, DB>(db).await } else { - println!("cannot import {} history", shell); + println!("cannot import {shell} history"); Ok(()) } } diff --git a/src/command/client/search.rs b/src/command/client/search.rs index b87b86c9..456846d4 100644 --- a/src/command/client/search.rs +++ b/src/command/client/search.rs @@ -64,7 +64,7 @@ impl Cmd { pub async fn run(self, db: &mut impl Database, settings: &Settings) -> Result<()> { if self.interactive { let item = interactive::history(&self.query, settings, db).await?; - eprintln!("{}", item); + eprintln!("{item}"); } else { let list_mode = ListMode::from_flags(self.human, self.cmd_only); let entries = run_non_interactive( diff --git a/src/command/client/search/duration.rs b/src/command/client/search/duration.rs index 3cdd4e83..1dc4245f 100644 --- a/src/command/client/search/duration.rs +++ b/src/command/client/search/duration.rs @@ -4,7 +4,7 @@ use std::{ops::ControlFlow, time::Duration}; pub fn format_duration(f: Duration) -> String { fn item(name: &str, value: u64) -> ControlFlow<String> { if value > 0 { - ControlFlow::Break(format!("{}{}", value, name)) + ControlFlow::Break(format!("{value}{name}")) } else { ControlFlow::Continue(()) } diff --git a/src/command/client/search/event.rs b/src/command/client/search/event.rs index 8044e278..0e791c96 100644 --- a/src/command/client/search/event.rs +++ b/src/command/client/search/event.rs @@ -43,7 +43,7 @@ impl Events { let tty = termion::get_tty().expect("Could not find tty"); for event in tty.events().flatten() { if let Err(err) = tx.send(Event::Input(event)) { - eprintln!("{}", err); + eprintln!("{err}"); return; } } diff --git a/src/command/client/search/interactive.rs b/src/command/client/search/interactive.rs index e23b7c69..2bc07da3 100644 --- a/src/command/client/search/interactive.rs +++ b/src/command/client/search/interactive.rs @@ -256,7 +256,7 @@ impl State { .split(chunks[0]); let title = Paragraph::new(Text::from(Span::styled( - format!("Atuin v{}", VERSION), + format!("Atuin v{VERSION}"), Style::default().fg(Color::DarkGray), ))); diff --git a/src/command/client/sync.rs b/src/command/client/sync.rs index 51fcbf63..b97a2240 100644 --- a/src/command/client/sync.rs +++ b/src/command/client/sync.rs @@ -41,7 +41,7 @@ impl Cmd { use atuin_client::encryption::{encode_key, load_key}; let key = load_key(&settings).wrap_err("could not load encryption key")?; let encode = encode_key(key).wrap_err("could not encode encryption key")?; - println!("{}", encode); + println!("{encode}"); Ok(()) } } diff --git a/src/command/client/sync/login.rs b/src/command/client/sync/login.rs index 333a1514..038e822b 100644 --- a/src/command/client/sync/login.rs +++ b/src/command/client/sync/login.rs @@ -72,6 +72,6 @@ pub(super) fn read_user_password() -> String { } fn read_user_input(name: &'static str) -> String { - eprint!("Please enter {}: ", name); + eprint!("Please enter {name}: "); get_input().expect("Failed to read from input") } |
