Implemented the 'help' builtin, and support for :h <topic> in ex mode

:h is an alias for the 'help' builtin.

'help' takes a single argument and tries to find a suitable match among the files in '$SHED_HPATH'

if a match is found, this file is opened in your pager

calling the 'help' builtin using :h in ex mode will preserve your current pending line
This commit is contained in:
2026-03-15 18:18:53 -04:00
parent f6a3935bcb
commit 99b9440ee1
18 changed files with 1080 additions and 52 deletions

View File

@@ -203,6 +203,7 @@ fn dedupe_entries(entries: &[HistEntry]) -> Vec<HistEntry> {
.collect()
}
#[derive(Default,Clone,Debug)]
pub struct History {
path: PathBuf,
pub pending: Option<LineBuf>, // command, cursor_pos
@@ -214,6 +215,7 @@ pub struct History {
//search_direction: Direction,
ignore_dups: bool,
max_size: Option<u32>,
stateless: bool
}
impl History {
@@ -229,6 +231,7 @@ impl History {
//search_direction: Direction::Backward,
ignore_dups: false,
max_size: None,
stateless: true,
}
}
pub fn new() -> ShResult<Self> {
@@ -266,6 +269,7 @@ impl History {
//search_direction: Direction::Backward,
ignore_dups,
max_size,
stateless: false,
})
}
@@ -450,6 +454,9 @@ impl History {
}
pub fn save(&mut self) -> ShResult<()> {
if self.stateless {
return Ok(());
}
let mut file = OpenOptions::new()
.create(true)
.append(true)