aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorJonas Maier <>2026-03-08 08:39:04 +0100
committerJonas Maier <>2026-03-08 08:39:04 +0100
commitc90c781a32af4304e647231be2a74a444f632a99 (patch)
tree3a3b1d293986af03d0fc2d7878b0b27a0521fc4e /src/main.rs
parentdeafab9c930ab092c4ee8abd4cbe09c7eb34aa22 (diff)
downloadpish-c90c781a32af4304e647231be2a74a444f632a99.tar.gz
history with paths
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 9a4e692..3687cd0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,5 @@
use std::collections::HashMap;
+use std::env::current_dir;
use std::ffi::OsStr;
use std::fs;
use std::io::{self, IsTerminal, Read, Write};
@@ -60,7 +61,13 @@ type bstr = [u8];
#[derive(Clone)]
struct HistoryEntry {
+ /// time of execution
pub time: date::DateTime,
+
+ /// absolute path where the command was executed
+ pub loc: BString,
+
+ /// the command
pub cmd: BString,
}
@@ -68,6 +75,7 @@ impl HistoryEntry {
pub fn new(cmd: BString) -> Self {
Self {
time: date::DateTime::now(),
+ loc: current_dir().unwrap().as_os_str().as_encoded_bytes().to_vec(),
cmd,
}
}