navi/README.md

99 lines
3.5 KiB
Markdown
Raw Normal View History

# navi <img src="https://user-images.githubusercontent.com/3226564/65362934-b4432500-dbdf-11e9-8f75-815fbc5cbf8f.png" alt="icon" height="28px"/> [![CircleCI](https://circleci.com/gh/denisidoro/navi.svg?style=svg)](https://circleci.com/gh/denisidoro/navi)
2019-09-20 20:01:12 +03:00
An interactive cheatsheet tool for the command-line so that you'll never say the following again:
2019-09-20 21:28:15 +03:00
>— *How to run that command again?*<br>
*Oh, it's not in my bash history*<br>
*Geez, it's almost what I wanted but I need to change some args*
2019-09-20 20:45:02 +03:00
2019-09-22 02:16:20 +03:00
![Demo](https://user-images.githubusercontent.com/3226564/65380182-69431380-dcac-11e9-9af8-0f7b3c869d0f.gif)
2019-09-20 20:01:12 +03:00
2019-09-20 22:10:02 +03:00
**navi** allows you to browse through cheatsheets (that you may write yourself or download from maintainers) and execute commands, prompting for argument values.
2019-09-20 20:01:12 +03:00
## Installation
**Using [brew](https://brew.sh/):**
2019-09-20 22:00:46 +03:00
```sh
2019-09-20 20:01:12 +03:00
brew install denisidoro/tools/navi
```
**Without brew:**
2019-09-20 22:00:46 +03:00
```sh
2019-09-20 20:01:12 +03:00
git clone http://github.com/denisidoro/navi /opt/navi
cd /opt/navi
sudo make install
2019-09-20 22:00:46 +03:00
# install fzf: https://github.com/junegunn/fzf
2019-09-20 20:01:12 +03:00
```
## Usage
2019-09-20 22:00:46 +03:00
Simply call:
```sh
navi
```
2019-09-20 21:28:15 +03:00
## Trying it out online
2019-09-20 22:00:46 +03:00
Head to [this playground](https://www.katacoda.com/denisidoro/scenarios/navi) for previewing **navi**.
2019-09-20 21:28:15 +03:00
2019-09-20 20:01:12 +03:00
## Motivation
The main objectives are:
- to increase discoverability, by finding commands given keywords or descriptions;
- to prevent you from running auxiliar commands, copying the result into the clipboard and then pasting into the original command;
2019-09-21 01:20:44 +03:00
- to easily share one-liners with others so that they don't need to figure out how to write the commands;
2019-09-20 20:01:12 +03:00
- to improve terminal usage as a whole.
Sure, you can find autocompleters out there for all your favorite commands. However, they are very specific and each one may offer a different learning curve.
2019-09-21 01:16:47 +03:00
Or you can launch a browser and search for instructions on Google, but that takes some time.
2019-09-20 20:01:12 +03:00
**navi**, on the other hand, intends to be a general purpose platform for bookmarking any command at a very low cost.
2019-09-20 22:00:46 +03:00
## Using your own cheatsheets
In this case, you need to pass the directory which contains `.cheat` files as in:
```sh
2019-09-21 00:44:51 +03:00
navi --dir "/folder/with/cheats"
```
Alternatively, you can set an environment variable in your `.bashrc`-like file:
```sh
export NAVI_DIR="/folder/with/cheats"
2019-09-20 22:00:46 +03:00
```
2019-09-21 01:16:47 +03:00
## Submitting cheatsheets
Feel free to fork this project and open a PR for me to include your contributions.
2019-09-20 20:01:12 +03:00
## .cheat syntax
- lines starting with `%` should contain tags which will be added to any command in a given file;
- lines starting with `#` should be descriptions of commands;
- lines starting with `$` should contain commands that generate suggestion values for a given argument;
- all the other non-empty lines are considered as executable commands.
For example, this is a valid `.cheat` file:
```sh
% git, code
# Change branch
git checkout <branch>
2019-09-22 02:16:20 +03:00
$ branch: git branch | awk '{print $NF}'
2019-09-20 20:01:12 +03:00
```
For advanced usage, please refer to the files in [/cheats](https://github.com/denisidoro/navi/tree/master/cheats).
## Alternatives
2019-09-21 18:00:56 +03:00
- [cmdmenu](https://github.com/amacfie/cmdmenu);
2019-09-20 20:01:12 +03:00
- [denisidoro/beavr](https://github.com/denisidoro/beavr);
- [how2](https://github.com/santinic/how2);
- [howdoi](https://github.com/gleitz/howdoi);
- [cheat](https://github.com/cheat/cheat).
## Etymology
In [The Legend of Zelda Ocarina of Time](https://zelda.gamepedia.com/Ocarina_of_Time), [navi](https://zelda.gamepedia.com/Navi) is a character that provides [Link](https://zelda.gamepedia.com/Link) with a variety of clues to help him solve puzzles and progress in his quest.