forked from atuinsh/atuin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Useful for debugging, checking the state of things, and for if you forget your username!
- Loading branch information
Showing
6 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use atuin_client::{ | ||
api_client, database::Database, encryption::load_encoded_key, settings::Settings, | ||
}; | ||
use colored::Colorize; | ||
use eyre::Result; | ||
|
||
pub async fn run(settings: &Settings, db: &impl Database) -> Result<()> { | ||
let client = api_client::Client::new( | ||
&settings.sync_address, | ||
&settings.session_token, | ||
load_encoded_key(settings)?, | ||
)?; | ||
|
||
let status = client.status().await?; | ||
let last_sync = Settings::last_sync()?; | ||
let local_count = db.history_count().await?; | ||
|
||
println!("{}", "[Local]".green()); | ||
|
||
if settings.auto_sync { | ||
println!("Sync frequency: {}", settings.sync_frequency); | ||
println!("Last sync: {last_sync}"); | ||
} | ||
|
||
println!("History count: {local_count}\n"); | ||
|
||
if settings.auto_sync { | ||
println!("{}", "[Remote]".green()); | ||
println!("Address: {}", settings.sync_address); | ||
println!("Username: {}", status.username); | ||
println!("History count: {}", status.count); | ||
} | ||
|
||
Ok(()) | ||
} |