Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workaround for --help #54

Merged
merged 4 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add workaround for --help
  • Loading branch information
denisidoro committed Sep 23, 2019
commit 7dd7da55c78d1f4e145b2ee2eb6f6804845d5f60
7 changes: 6 additions & 1 deletion navi
Original file line number Diff line number Diff line change
Expand Up @@ -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 with newlines
case "${1:-}" in
help|--help) opts::extract_help "$0" && exit 0 ;;
esac

OPTIONS="$(opts::eval "$@")"
export NAVI_PATH="$(dict::get "$OPTIONS" path)"
Expand Down
3 changes: 1 addition & 2 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ handler::main() {

value="$(arg::pick "$arg" "$cheat" || echo "")"
if [ -z "$value" ]; then
echoerr "Unable to fetch suggestions for '$arg'!"
echo "$cmd"
exit 0
fi

Expand Down Expand Up @@ -58,7 +58,6 @@ handler::preview() {

handler::text() {
dict::get "$OPTIONS" text
ui::clear_previous_line
}

main() {
Expand Down
2 changes: 1 addition & 1 deletion src/opts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down