mirror of
https://github.com/denisidoro/navi
synced 2025-02-16 12:38:28 +00:00
Add workaround for --help (#54)
My latest refactor didn't play nice with `--help`so I'm adding this workaround
This commit is contained in:
parent
e3b67bd731
commit
2ee253a56e
3 changed files with 7 additions and 3 deletions
7
navi
7
navi
|
@ -35,7 +35,12 @@ source "${SCRIPT_DIR}/src/main.sh"
|
||||||
##? full docs
|
##? full docs
|
||||||
##? Please refer to the README at https://github.com/denisidoro/navi
|
##? Please refer to the README at https://github.com/denisidoro/navi
|
||||||
|
|
||||||
VERSION="0.9.0"
|
VERSION="0.9.1"
|
||||||
|
|
||||||
|
# workaround while dict::* can't handle newlines
|
||||||
|
case "${1:-}" in
|
||||||
|
help|--help) opts::extract_help "$0" && exit 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
OPTIONS="$(opts::eval "$@")"
|
OPTIONS="$(opts::eval "$@")"
|
||||||
export NAVI_PATH="$(dict::get "$OPTIONS" path)"
|
export NAVI_PATH="$(dict::get "$OPTIONS" path)"
|
||||||
|
|
|
@ -58,7 +58,6 @@ handler::preview() {
|
||||||
|
|
||||||
handler::text() {
|
handler::text() {
|
||||||
dict::get "$OPTIONS" text
|
dict::get "$OPTIONS" text
|
||||||
ui::clear_previous_line
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
|
@ -25,7 +25,7 @@ opts::eval() {
|
||||||
case $arg in
|
case $arg in
|
||||||
--print) print=true ;;
|
--print) print=true ;;
|
||||||
--no-interpolation) interpolation=false ;;
|
--no-interpolation) interpolation=false ;;
|
||||||
--version) dict::new entry_point "text" text "${VERSION:-unknown}" && exit 0 ;;
|
--version|version) dict::new entry_point "text" text "${VERSION:-unknown}" && exit 0 ;;
|
||||||
help|--help) dict::new entry_point "text" text "$(opts::extract_help "$0")" && exit 0 ;;
|
help|--help) dict::new entry_point "text" text "$(opts::extract_help "$0")" && exit 0 ;;
|
||||||
--command-for) wait_for="command-for" ;;
|
--command-for) wait_for="command-for" ;;
|
||||||
--no-preview) preview=false ;;
|
--no-preview) preview=false ;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue