diff options
-rwxr-xr-x | gist | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -587,6 +587,19 @@ usage() { | |||
587 | sed -E -n -e ' /^$/ q; 7,$ s/^# //p' "$0" | 587 | sed -E -n -e ' /^$/ q; 7,$ s/^# //p' "$0" |
588 | } | 588 | } |
589 | 589 | ||
590 | _check_protocol() { | ||
591 | find $folder -maxdepth 1 -mindepth 1 -type d \ | ||
592 | | while read -r repo; do | ||
593 | cd "$repo" || exit 1 | ||
594 | url=$(git remote get-url origin) | ||
595 | if [[ $protocol == 'ssh' && $url =~ ^https ]]; then | ||
596 | git remote set-url origin "git@gist.github.com:$(basename `pwd`).git" | ||
597 | elif [[ $protocol == 'https' && $url =~ ^git ]]; then | ||
598 | git remote set-url origin "https://gist.github.com/$(basename `pwd`).git" | ||
599 | fi | ||
600 | done | ||
601 | } | ||
602 | |||
590 | _apply_config "$@" || exit 1 | 603 | _apply_config "$@" || exit 1 |
591 | getConfiguredClient || exit 1 | 604 | getConfiguredClient || exit 1 |
592 | if [[ $init ]]; then _fetch_gists; exit 0; fi | 605 | if [[ $init ]]; then _fetch_gists; exit 0; fi |
@@ -615,7 +628,7 @@ case "$1" in | |||
615 | _clean_repos ;; | 628 | _clean_repos ;; |
616 | config | c) | 629 | config | c) |
617 | shift | 630 | shift |
618 | _configure "$@" ;; | 631 | _configure "$@" && (_apply_config config && _check_protocol) ;; |
619 | user | U) | 632 | user | U) |
620 | shift | 633 | shift |
621 | _query_user "$@" ;; | 634 | _query_user "$@" ;; |