This commit is contained in:
Denis Isidoro 2019-09-20 16:00:46 -03:00
parent de79f4dc14
commit 9cb06524c0
3 changed files with 22 additions and 10 deletions

View file

@ -13,25 +13,28 @@ An interactive cheatsheet tool for the command-line so that you'll never say the
## Installation ## Installation
**Using [brew](https://brew.sh/):** **Using [brew](https://brew.sh/):**
``` ```sh
brew install denisidoro/tools/navi brew install denisidoro/tools/navi
``` ```
**Without brew:** **Without brew:**
``` ```sh
git clone http://github.com/denisidoro/navi /opt/navi git clone http://github.com/denisidoro/navi /opt/navi
cd /opt/navi cd /opt/navi
sudo make install sudo make install
# install fzf: https://github.com/junegunn/fzf
``` ```
## Usage ## Usage
Simply call `navi` Simply call:
```sh
navi
```
## Trying it out online ## Trying it out online
Head to [this playground](https://www.katacoda.com/denisidoro/scenarios/navi) for previewing *navi*. Head to [this playground](https://www.katacoda.com/denisidoro/scenarios/navi) for previewing **navi**.
## Motivation ## Motivation
@ -46,6 +49,13 @@ Or you can launch and browser and search for instructions on Google, but that ta
**navi**, on the other hand, intends to be a general purpose platform for bookmarking any command at a very low cost. **navi**, on the other hand, intends to be a general purpose platform for bookmarking any command at a very low cost.
## Using your own cheatsheets
In this case, you need to pass the directory which contains `.cheat` files as in:
```sh
navi --dir /folder/with/cheats
```
## .cheat syntax ## .cheat syntax
- lines starting with `%` should contain tags which will be added to any command in a given file; - lines starting with `%` should contain tags which will be added to any command in a given file;

2
navi
View file

@ -22,6 +22,6 @@ source "${SCRIPT_DIR}/src/main.sh"
##? --print Prevent script execution [default: false] ##? --print Prevent script execution [default: false]
##? --no-interpolation Prevent argument interpolation [default: false] ##? --no-interpolation Prevent argument interpolation [default: false]
VERSION="0.4.0" VERSION="0.5.0"
docs::eval "$@" docs::eval "$@"
main "$@" main "$@"

View file

@ -13,6 +13,10 @@ docs::eval() {
interpolation=true interpolation=true
for arg in $@; do for arg in $@; do
case $wait_for in
dir) cheat_dir="$arg"; wait_for="";;
esac
case $arg in case $arg in
--print) print=true;; --print) print=true;;
--no-interpolation) interpolation=false;; --no-interpolation) interpolation=false;;
@ -20,9 +24,7 @@ docs::eval() {
--help) docs::extract_help "$0" && exit 0;; --help) docs::extract_help "$0" && exit 0;;
-d|--dir) wait_for="dir";; -d|--dir) wait_for="dir";;
esac esac
case $wait_for in
dir) cheat_dir="$arg"; wait_for="";;
esac
done done
echo "cheat_dir: ${cheat_dir:-}"
} }