diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2020-06-29 13:39:29 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2020-06-29 13:39:29 +0800 |
commit | 9e504b7d7175a7144cf3e987939aebf1575ec5e5 (patch) | |
tree | 57f80042115452dea5ff39b2004443feae8db6d9 | |
parent | c3da16aaa318a0db7b814d36b23fc72ec08d33e5 (diff) |
Fix argument issue
- 'gist -n [INDEX]' now is valid
- Use extended glob to check range
-rwxr-xr-x | gist | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -48,7 +48,6 @@ | |||
48 | # Since now a gist is a local cloned repo | 48 | # Since now a gist is a local cloned repo |
49 | # It is your business to do git commit and git push | 49 | # It is your business to do git commit and git push |
50 | 50 | ||
51 | # FIXME 'gist -n [N]' is refered to range | ||
52 | # TODO Save HEADER with wget and httpie | 51 | # TODO Save HEADER with wget and httpie |
53 | # TODO user friendly config file | 52 | # TODO user friendly config file |
54 | # TODO feature to exclude tag-value or grep-string | 53 | # TODO feature to exclude tag-value or grep-string |
@@ -539,6 +538,7 @@ _goto_gist() { | |||
539 | 538 | ||
540 | # Return the path of local repo with a given index | 539 | # Return the path of local repo with a given index |
541 | _goto_gist_by_index() { | 540 | _goto_gist_by_index() { |
541 | [[ $1 =~ (-n|--no-action) ]] && set -- $2 -n # move '-n' as the last argument | ||
542 | _gist_id "$1" || return 1 | 542 | _gist_id "$1" || return 1 |
543 | 543 | ||
544 | if [[ ! -d $folder/$GIST_ID ]]; then | 544 | if [[ ! -d $folder/$GIST_ID ]]; then |
@@ -844,6 +844,7 @@ _access_last_index() { | |||
844 | 844 | ||
845 | _apply_config "$@" || exit 1 | 845 | _apply_config "$@" || exit 1 |
846 | if [[ $init ]]; then _update_gists; exit 0; fi | 846 | if [[ $init ]]; then _update_gists; exit 0; fi |
847 | shopt -s extglob | ||
847 | case "$1" in | 848 | case "$1" in |
848 | "") | 849 | "") |
849 | _print_records ;; | 850 | _print_records ;; |
@@ -896,7 +897,7 @@ case "$1" in | |||
896 | lan | l) | 897 | lan | l) |
897 | shift | 898 | shift |
898 | _gists_with_languages "$@" ;; | 899 | _gists_with_languages "$@" ;; |
899 | *-*) | 900 | *([s0-9])-*([s0-9])) |
900 | mark=.; _gists_with_range "$@" ;; | 901 | mark=.; _gists_with_range "$@" ;; |
901 | last | L) | 902 | last | L) |
902 | _access_last_index "$@" ;; | 903 | _access_last_index "$@" ;; |