Merge branch 'master' of github.com:tzhouhc/navi into tzhouhc-master

This commit is contained in:
alexis-opolka 2026-03-12 13:57:43 +01:00
commit faf360fb40
2 changed files with 16 additions and 6 deletions

View file

@ -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)

View file

@ -22,6 +22,9 @@ pub enum RepoCommand {
/// Lets you target a specific git ref (e.g. a branch), anything accepted by the `--branch` parameter of `git-clone`
#[clap(short = 'b', long = "branch")]
branch: Option<String>,
/// Import all cheatsheets from repo without prompting
#[clap(short = 'a', long, visible_short_alias = 'y', visible_alias = "yes")]
all: bool,
},
/// Synchronize either all cheatsheet repositories or a given one.
Sync {
@ -30,6 +33,12 @@ pub enum RepoCommand {
},
/// List all downloaded repositories
List,
/// Browses for featured cheatsheet repos
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)]
@ -61,17 +70,18 @@ impl Runnable for Input {
match &self.cmd {
RepoCommand::Add {
uri,
yes_flag,
branch,
all,
yes_flag,
} => {
add::main(uri.clone(), *yes_flag, branch)
add::main(uri.clone(), branch, *all, *yes_flag)
.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(), false, &None)
add::main(repo.clone(), *all, false, &None)
.with_context(|| format!("Failed to import cheatsheets from `{repo}`"))?;
commands::core::main()