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

@@ -1098,6 +1098,8 @@ impl VarTab {
.map(|hname| hname.to_string_lossy().to_string())
.unwrap_or_default();
let help_paths = format!("/usr/share/shed/doc:{home}/.local/share/shed/doc");
unsafe {
env::set_var("IFS", " \t\n");
env::set_var("HOST", hostname.clone());
@@ -1114,6 +1116,7 @@ impl VarTab {
env::set_var("SHELL", pathbuf_to_string(std::env::current_exe()));
env::set_var("SHED_HIST", format!("{}/.shedhist", home));
env::set_var("SHED_RC", format!("{}/.shedrc", home));
env::set_var("SHED_HPATH", help_paths);
}
}
pub fn init_sh_argv(&mut self) {