From 9e504b7d7175a7144cf3e987939aebf1575ec5e5 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 29 Jun 2020 13:39:29 +0800 Subject: Fix argument issue - 'gist -n [INDEX]' now is valid - Use extended glob to check range --- gist | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gist b/gist index 79d3379..f54287f 100755 --- a/gist +++ b/gist @@ -48,7 +48,6 @@ # Since now a gist is a local cloned repo # It is your business to do git commit and git push -# FIXME 'gist -n [N]' is refered to range # TODO Save HEADER with wget and httpie # TODO user friendly config file # TODO feature to exclude tag-value or grep-string @@ -539,6 +538,7 @@ _goto_gist() { # Return the path of local repo with a given index _goto_gist_by_index() { + [[ $1 =~ (-n|--no-action) ]] && set -- $2 -n # move '-n' as the last argument _gist_id "$1" || return 1 if [[ ! -d $folder/$GIST_ID ]]; then @@ -844,6 +844,7 @@ _access_last_index() { _apply_config "$@" || exit 1 if [[ $init ]]; then _update_gists; exit 0; fi +shopt -s extglob case "$1" in "") _print_records ;; @@ -896,7 +897,7 @@ case "$1" in lan | l) shift _gists_with_languages "$@" ;; - *-*) + *([s0-9])-*([s0-9])) mark=.; _gists_with_range "$@" ;; last | L) _access_last_index "$@" ;; -- cgit v1.2.3-70-g09d2