Commit 1cae4fc91f098d37437a3e1dd6384df5b83911fd
1 parent
a5e21a6a10
Some refactoring and more tests to url resolver.
Showing 2 changed files with 11 additions and 2 deletions Side-by-side Diff
antigen.zsh
| ... | ... | @@ -69,13 +69,13 @@ antigen-bundle () { |
| 69 | 69 | |
| 70 | 70 | local url="$1" |
| 71 | 71 | |
| 72 | + # Expand short github url syntax: `username/reponame` | |
| 72 | 73 | if [[ $url != git://* && \ |
| 73 | 74 | $url != https://* && \ |
| 74 | 75 | $url != /* && \ |
| 75 | 76 | $url != git@github.com:*/* |
| 76 | 77 | ]]; then |
| 77 | - url="${url%.git}" | |
| 78 | - url="https://github.com/$url.git" | |
| 78 | + url="https://github.com/${url%.git}.git" | |
| 79 | 79 | fi |
| 80 | 80 | |
| 81 | 81 | echo "$url" |
tests/url-resolver.t
| ... | ... | @@ -11,6 +11,15 @@ Complete urls. |
| 11 | 11 | $ resolve git@github.com:zsh-users/antigen.git |
| 12 | 12 | git@github.com:zsh-users/antigen.git |
| 13 | 13 | |
| 14 | +Complete github urls, missing the `.git` suffix. | |
| 15 | + | |
| 16 | + $ resolve https://github.com/zsh-users/antigen | |
| 17 | + https://github.com/zsh-users/antigen | |
| 18 | + $ resolve git://github.com/zsh-users/antigen | |
| 19 | + git://github.com/zsh-users/antigen | |
| 20 | + $ resolve git@github.com:zsh-users/antigen | |
| 21 | + git@github.com:zsh-users/antigen | |
| 22 | + | |
| 14 | 23 | Just username and repo name. |
| 15 | 24 | |
| 16 | 25 | $ resolve zsh-users/antigen |