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:
Denis Isidoro 2019-09-23 19:52:02 -03:00 committed by GitHub
parent e3b67bd731
commit 2ee253a56e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

7
navi
View file

@ -35,7 +35,12 @@ source "${SCRIPT_DIR}/src/main.sh"
##? full docs
##? 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 "$@")"
export NAVI_PATH="$(dict::get "$OPTIONS" path)"

View file

@ -58,7 +58,6 @@ handler::preview() {
handler::text() {
dict::get "$OPTIONS" text
ui::clear_previous_line
}
main() {

View file

@ -25,7 +25,7 @@ opts::eval() {
case $arg in
--print) print=true ;;
--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 ;;
--command-for) wait_for="command-for" ;;
--no-preview) preview=false ;;