aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/history.rs
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-01-12 16:02:08 +0000
committerGitHub <noreply@github.com>2024-01-12 16:02:08 +0000
commit99249ea319fca96ace8f3f4962534dc7a4bc5923 (patch)
tree61103701633c6e4afec21d1108faddbc20e90d9e /atuin-client/src/history.rs
parentchore: update funding (#1543) (diff)
downloadatuin-99249ea319fca96ace8f3f4962534dc7a4bc5923.zip
feat: Add interactive command inspector (#1296)
* Begin work on command inspector This is a separate pane in the interactive mode that allows for exploration and inspecting of specific commands. I've restructured things a bit. It made logical sense that things were nested under commands, however the whole point of `atuin` is to provide commands. Breaking things out like this enables a bit less crazy nesting as we add more functionality to things like interactive search. I'd like to add a few more interactive things and it was starting to feel very cluttered * Some vague tab things * functioning inspector with stats * add interactive delete to inspector * things * clippy * borders * sus * revert restructure for another pr * Revert "sus" This reverts commit d4bae8cf614d93b728621f7985cf4e387b6dc113.
Diffstat (limited to 'atuin-client/src/history.rs')
-rw-r--r--atuin-client/src/history.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/atuin-client/src/history.rs b/atuin-client/src/history.rs
index 8c312dc2..0147e25b 100644
--- a/atuin-client/src/history.rs
+++ b/atuin-client/src/history.rs
@@ -71,6 +71,26 @@ pub struct History {
pub deleted_at: Option<OffsetDateTime>,
}
+#[derive(Debug, Clone, PartialEq, Eq, sqlx::FromRow)]
+pub struct HistoryStats {
+ /// The command that was ran after this one in the session
+ pub next: Option<History>,
+ ///
+ /// The command that was ran before this one in the session
+ pub previous: Option<History>,
+
+ /// How many times has this command been ran?
+ pub total: u64,
+
+ pub average_duration: u64,
+
+ pub exits: Vec<(i64, i64)>,
+
+ pub day_of_week: Vec<(String, i64)>,
+
+ pub duration_over_time: Vec<(String, i64)>,
+}
+
impl History {
#[allow(clippy::too_many_arguments)]
fn new(