diff options
| author | Alexandre GV. <contact@alexandregv.fr> | 2025-01-07 21:16:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-07 20:16:48 +0000 |
| commit | 522c16726f2a417ff403af9a4978d7363f7da094 (patch) | |
| tree | 63429c6088a4ded1a29f59efe4dc86ad2610cec7 | |
| parent | style: Avoid calling `unwrap()` when we don't have to (#2519) (diff) | |
| download | atuin-522c16726f2a417ff403af9a4978d7363f7da094.zip | |
fix(wrapped): fix crash when history is empty (#2508)
* fix(wrapped): fix crash when history is empty
* style: fix format
| -rw-r--r-- | crates/atuin/src/command/client/wrapped.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/atuin/src/command/client/wrapped.rs b/crates/atuin/src/command/client/wrapped.rs index 7c5ca058..4dbc1cf0 100644 --- a/crates/atuin/src/command/client/wrapped.rs +++ b/crates/atuin/src/command/client/wrapped.rs @@ -280,6 +280,10 @@ pub async fn run( ); let history = db.range(start, end).await?; + if history.is_empty() { + println!("Your history for {year} is empty!\nMaybe 'atuin import' could help you import your previous history 🪄"); + return Ok(()); + } // Compute overall stats using existing functionality let stats = compute(settings, &history, 10, 1).expect("Failed to compute stats"); |
