mirror of
https://github.com/denisidoro/navi
synced 2024-11-21 19:13:07 +00:00
Improve README (#1)
This commit is contained in:
parent
132aee10ce
commit
5a00cb4417
5 changed files with 19 additions and 9 deletions
|
@ -6,7 +6,7 @@ An interactive cheatsheet tool for the command-line so that you'll never say the
|
|||
*- Oh, it's not in my bash history*
|
||||
*- Geez, it's almost what I wanted but I need to change some args*
|
||||
|
||||
![Demo](https://user-images.githubusercontent.com/3226564/65281359-d158f480-db08-11e9-8e69-e380d76c343b.gif)
|
||||
![Demo](https://user-images.githubusercontent.com/3226564/65347073-8dbbc480-dbb4-11e9-886f-0f10d56def74.gif)
|
||||
|
||||
**navi** allows you to browse through cheatsheets (that you may write yourself or downloaded from maintainers) and execute commands, prompting for argument values.
|
||||
|
||||
|
|
2
navi
2
navi
|
@ -22,6 +22,6 @@ source "${SCRIPT_DIR}/src/main.sh"
|
|||
##? --print Prevent script execution [default: false]
|
||||
##? --no-interpolation Prevent argument interpolation [default: false]
|
||||
|
||||
VERSION="0.3.0"
|
||||
VERSION="0.4.0"
|
||||
docs::eval "$@"
|
||||
main "$@"
|
||||
|
|
|
@ -11,10 +11,10 @@ cheat::read_many() {
|
|||
printf("\033[%dm%s\033[0m",30+c,s)
|
||||
}
|
||||
|
||||
/^%/ { tags=substr($0, 3); next }
|
||||
/^#/ { print color(3, tags"^") color(4, $0); next }
|
||||
/^%/ { tags=" ["substr($0, 3)"]"; next }
|
||||
/^#/ { print color(4, $0) color(60, tags); next }
|
||||
/^\$/ { next }
|
||||
NF { print color(3, tags"^") color(7, $0); next }' "$cheat"
|
||||
NF { print color(7, $0) color(60, tags); next }' "$cheat"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
selection::standardize() {
|
||||
local readonly str="$(cat)"
|
||||
|
||||
local readonly tags="$(echo "$str" | awk -F'[' '{print $NF}' | tr -d ']')"
|
||||
local readonly core="$(echo "$str" | sed -e "s/ \[${tags}\]$//")"
|
||||
|
||||
echo "${core}^${tags}"
|
||||
}
|
||||
|
||||
selection::core() {
|
||||
cut -d'^' -f2
|
||||
cut -d'^' -f1
|
||||
}
|
||||
|
||||
selection::tags() {
|
||||
cut -d'^' -f1
|
||||
cut -d'^' -f2
|
||||
}
|
||||
|
||||
selection::core_is_comment() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ui::pick() {
|
||||
fzf --inline-info "$@"
|
||||
fzf --height '100%' --inline-info "$@"
|
||||
}
|
||||
|
||||
ui::select() {
|
||||
|
@ -9,7 +9,8 @@ ui::select() {
|
|||
|
||||
echo "$cheats" \
|
||||
| cheat::read_many \
|
||||
| ui::pick -i --ansi --delimiter '\^' --with-nth 2
|
||||
| ui::pick -i --ansi \
|
||||
| selection::standardize
|
||||
}
|
||||
|
||||
ui::clear_previous_line() {
|
||||
|
|
Loading…
Reference in a new issue