diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index 66447161..d3183b9c 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -25,6 +25,8 @@ const COMMAND_NAME: &str = "slumber"; /// Configurable HTTP client with both TUI and CLI interfaces /// /// If subcommand is omitted, start the TUI. +/// +/// https://slumber.lucaspickering.me/book/ #[derive(Debug, Parser)] #[clap(author, version, about, name = COMMAND_NAME)] pub struct Args { diff --git a/crates/core/src/util.rs b/crates/core/src/util.rs index 1e785c77..cbb01cba 100644 --- a/crates/core/src/util.rs +++ b/crates/core/src/util.rs @@ -20,7 +20,6 @@ use std::{ use tokio::sync::{Mutex, OwnedRwLockWriteGuard, RwLock}; use tracing::error; -const WEBSITE: &str = "https://slumber.lucaspickering.me"; /// Link to the GitHub New Issue form pub const NEW_ISSUE_LINK: &str = "https://github.com/LucasPickering/slumber/issues/new/choose"; @@ -36,7 +35,12 @@ pub const NEW_ISSUE_LINK: &str = /// ); /// ``` pub fn doc_link(path: &str) -> String { - format!("{WEBSITE}/book/{path}.html") + const ROOT: &str = "https://slumber.lucaspickering.me/book/"; + if path.is_empty() { + ROOT.into() + } else { + format!("{ROOT}{path}.html") + } } /// Parse bytes from a reader into YAML. This will merge any anchors/aliases. diff --git a/crates/tui/src/view/component/help.rs b/crates/tui/src/view/component/help.rs index d0209c22..47d77970 100644 --- a/crates/tui/src/view/component/help.rs +++ b/crates/tui/src/view/component/help.rs @@ -14,7 +14,7 @@ use ratatui::{ Frame, }; use slumber_config::{Action, Config, InputBinding}; -use slumber_core::util::paths; +use slumber_core::util::{doc_link, paths}; const CRATE_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -53,7 +53,7 @@ pub struct HelpModal; impl HelpModal { /// Number of lines in the general section (not including header) - const GENERAL_LENGTH: u16 = 4; + const GENERAL_LENGTH: u16 = 5; /// Get the list of bindings that will be shown in the modal fn bindings() -> impl Iterator { @@ -97,6 +97,7 @@ impl Draw for HelpModal { title: Some("General"), rows: [ ("Version", Line::from(CRATE_VERSION)), + ("Docs", doc_link("").into()), ("Configuration", Config::path().display().to_string().into()), ("Log", paths::log_file().display().to_string().into()), (