From 820a7b9b3130c23fea02f2b94572f3e7a7eab735 Mon Sep 17 00:00:00 2001 From: astr0n0mer <42691857+astr0n0mer@users.noreply.github.com> Date: Mon, 18 Aug 2025 16:18:33 +0530 Subject: [PATCH 1/2] docs: fixes broken links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a6db6c7..3c57832 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ There are multiple ways to use **navi**: - by typing `navi` in the terminal - pros: you have access to all possible subcommands and flags -- as a [shell widget](docs/installation/README.md#installing-the-shell-widget) for the terminal +- as a [shell widget](docs/widgets/README.md#installing-the-shell-widget) for the terminal - pros: the shell history is correctly populated (i.e. with the actual command you ran instead of `navi`) and you can edit the command as you wish before executing it - as a [Tmux widget](docs/widgets/howto/TMUX.md) - pros: you can use your cheatsheets in any command-line app even in SSH sessions @@ -60,7 +60,7 @@ Running **navi** for the first time will help you download and manage cheatsheet You can also: -- [browse through featured cheatsheets](docs/usage/commands/repo/README.md#browsing-through-cheatsheet-repositorieea) +- [browse through featured cheatsheets](docs/usage/commands/repo/README.md#browsing-through-cheatsheet-repositories) - [import cheatsheets from git repositories](docs/cheatsheet/repositories/README.md#importing-cheatsheet-repositories) - [write your own cheatsheets](#cheatsheet-syntax) (and [share them](docs/cheatsheet/repositories/README.md#submitting-cheatsheets), if you want) - [use cheatsheets from other tools](docs/cheatsheet/README.md#using-cheatsheets-from-other-tools), such as [tldr](https://github.com/tldr-pages/tldr) and [cheat.sh](https://github.com/chubin/cheat.sh) From f30475a9906552fe44e3019b290eb0ee13a30f5f Mon Sep 17 00:00:00 2001 From: Ting Zhou Date: Fri, 19 Dec 2025 03:04:39 -0500 Subject: [PATCH 2/2] feat: Add `-a`/`--all` for repo commands to skip confirmation Using `-a` will skip the "Do you want to import all files from this repo?" check and assume yes, since I found out that the `yes` tool doesn't work for this somehow? Also aliased to `-y/--yes`. --- src/commands/repo/add.rs | 4 ++-- src/commands/repo/mod.rs | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/commands/repo/add.rs b/src/commands/repo/add.rs index 0c00a75..01a1d5b 100644 --- a/src/commands/repo/add.rs +++ b/src/commands/repo/add.rs @@ -25,10 +25,10 @@ fn ask_if_should_import_all(finder: &FinderChoice) -> Result { Ok(response.to_lowercase().starts_with('y')) } -pub fn main(uri: String) -> Result<()> { +pub fn main(uri: String, import_all: bool) -> Result<()> { let finder = CONFIG.finder(); - let should_import_all = ask_if_should_import_all(&finder).unwrap_or(false); + let should_import_all = import_all || ask_if_should_import_all(&finder).unwrap_or(false); let (actual_uri, user, repo) = git::meta(uri.as_str()); let cheat_pathbuf = filesystem::default_cheat_pathbuf()?; diff --git a/src/commands/repo/mod.rs b/src/commands/repo/mod.rs index be5dd25..b0d0c84 100644 --- a/src/commands/repo/mod.rs +++ b/src/commands/repo/mod.rs @@ -11,9 +11,16 @@ pub enum RepoCommand { Add { /// A URI to a git repository containing .cheat files ("user/repo" will download cheats from github.com/user/repo) uri: String, + /// Import all cheatsheets from repo without prompting + #[clap(short = 'a', long, visible_short_alias = 'y', visible_alias = "yes")] + all: bool, }, /// Browses for featured cheatsheet repos - Browse, + Browse { + /// Import all cheatsheets from selected repo without prompting + #[clap(short = 'a', long, visible_short_alias = 'y', visible_alias = "yes")] + all: bool, + }, } #[derive(Debug, Clone, Args)] @@ -25,14 +32,14 @@ pub struct Input { impl Runnable for Input { fn run(&self) -> Result<()> { match &self.cmd { - RepoCommand::Add { uri } => { - add::main(uri.clone()) + RepoCommand::Add { uri, all } => { + add::main(uri.clone(), *all) .with_context(|| format!("Failed to import cheatsheets from `{uri}`"))?; commands::core::main() } - RepoCommand::Browse => { + RepoCommand::Browse { all } => { let repo = browse::main().context("Failed to browse featured cheatsheets")?; - add::main(repo.clone()) + add::main(repo.clone(), *all) .with_context(|| format!("Failed to import cheatsheets from `{repo}`"))?; commands::core::main() }