From 269d5f552c377e73dd3371b312cf182b3bfc36af Mon Sep 17 00:00:00 2001 From: iladin Date: Mon, 26 Dec 2016 12:29:03 -0800 Subject: [PATCH] Added Gitlab support clone of bitbucket.zsh --- base/sources/gitlab.zsh | 47 +++++++++++++++++++++++++++++++++++ doc/guide/External-Sources.md | 1 + doc/man/man1/zplug.1 | 10 ++++++-- doc/man/man5/zplug-from.5 | 2 +- doc/txt/zplug-from.txt | 8 +++--- doc/zplug.txt | 9 +++++-- misc/completions/_zplug | 2 +- 7 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 base/sources/gitlab.zsh diff --git a/base/sources/gitlab.zsh b/base/sources/gitlab.zsh new file mode 100644 index 0000000..314c945 --- /dev/null +++ b/base/sources/gitlab.zsh @@ -0,0 +1,47 @@ +__zplug::sources::gitlab::check() +{ + __zplug::sources::github::check "$argv[@]" +} + +__zplug::sources::gitlab::install() +{ + __zplug::sources::github::install "$argv[@]" +} + +__zplug::sources::gitlab::update() +{ + __zplug::sources::github::update "$argv[@]" +} + +__zplug::sources::gitlab::get_url() +{ + local repo="$1" url_format + + case "$ZPLUG_PROTOCOL" in + HTTPS | https) + # https://git::@gitlab.com/%s.git + url_format="https://git::@gitlab.com/${repo}.git" + ;; + SSH | ssh) + # git@gitlab.com:%s.git + url_format="git@gitlab.com:${repo}.git" + ;; + esac + + echo "$url_format" +} + +__zplug::sources::gitlab::load_plugin() +{ + __zplug::sources::github::load_plugin "$argv[@]" +} + +__zplug::sources::gitlab::load_command() +{ + __zplug::sources::github::load_command "$argv[@]" +} + +__zplug::sources::gitlab::load_theme() +{ + __zplug::sources::github::load_theme "$argv[@]" +} diff --git a/doc/guide/External-Sources.md b/doc/guide/External-Sources.md index 17672c2..7800aa2 100644 --- a/doc/guide/External-Sources.md +++ b/doc/guide/External-Sources.md @@ -4,6 +4,7 @@ If there is a service/framework you want to install from that's not supported by zplug (yet!), you can add your own. We call these "sources." [GitHub](https://github.com), [Bitbucket](https://bitbucket.org), [GitHub Gist](https://gist.github.com), GitHub releases, +[Gitlab](https://gitlab.com), [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh), and [prezto](https://github.com/sorin-ionescu/prezto) are supported by default. Sources are what you specify with the `from` tag (e.g. `from:bitbucket`), so diff --git a/doc/man/man1/zplug.1 b/doc/man/man1/zplug.1 index b75c8dc..e972049 100644 --- a/doc/man/man1/zplug.1 +++ b/doc/man/man1/zplug.1 @@ -53,7 +53,8 @@ Can manage everything .IP \(bu 2.3 .\} Zsh plugins/UNIX commands on -GitHub +GitHub, +Gitlab and Bitbucket .RE @@ -380,7 +381,7 @@ T}:T{ Specify the service from which you install T}:T{ .sp -github,bitbucket,gh\-r,gist, oh\-my\-zsh,prezto,local (github) +github,gitlab,bitbucket,gh\-r,gist, oh\-my\-zsh,prezto,local (github) T}:T{ .sp from:gh\-r @@ -764,6 +765,11 @@ zplug "b4b4r07/hello_bitbucket", \e hook\-build:"chmod 755 *\&.sh", \e use:"*\&.sh" +# Support Gitlab +zplug "willemmali-sh/chegit", \e + as:command, \e + from:gitlab + # Group dependencies, emoji\-cli depends on jq in this example zplug "stedolan/jq", \e as:command, \e diff --git a/doc/man/man5/zplug-from.5 b/doc/man/man5/zplug-from.5 index 16c3e86..e977e7b 100644 --- a/doc/man/man5/zplug-from.5 +++ b/doc/man/man5/zplug-from.5 @@ -50,7 +50,7 @@ T} lt lt. T{ .sp -github, bitbucket, gh\-r, gist, oh\-my\-zsh, local +github, gitlab, bitbucket, gh\-r, gist, oh\-my\-zsh, local T}:T{ .sp github diff --git a/doc/txt/zplug-from.txt b/doc/txt/zplug-from.txt index 3d442a3..90e0ade 100644 --- a/doc/txt/zplug-from.txt +++ b/doc/txt/zplug-from.txt @@ -23,10 +23,10 @@ will be installed as the plugin or as the command. .zplug from tag [options="header"] -|================================================================ -| Possive Values | Default value -| github, bitbucket, gh-r, gist, oh-my-zsh, local | github -|================================================================ +|========================================================================= +| Possive Values | Default value +| github, gitlab, bitbucket, gh-r, gist, oh-my-zsh, local | github +|========================================================================= Besides, by using `zstyle` command, you can change default value: diff --git a/doc/zplug.txt b/doc/zplug.txt index 905922e..ff88c99 100644 --- a/doc/zplug.txt +++ b/doc/zplug.txt @@ -26,7 +26,7 @@ Unlike antigen, zplug requires no ZSH plugin file (`*.plugin.zsh`). It's such a fantabulous piece of software. * Can manage everything -** Zsh plugins/UNIX commands on https://github.com[GitHub] +** Zsh plugins/UNIX commands on https://github.com[GitHub], https://gitlab.com[Gitlab], and https://bitbucket.org[Bitbucket] ** Gist file (https://gist.github.com[gist.github.com]) ** Third-party sources e.g., @@ -123,7 +123,7 @@ and so on. If you want to use extended glob, see later section for setting the z `use:"*darwin*"` |*from* | Specify the service from which you install -| `github`,`bitbucket`,`gh-r`,`gist`, +| `github`, `gitlab`,`bitbucket`,`gh-r`,`gist`, `oh-my-zsh`,`prezto`,`local` (`github`) | `from:gh-r` |*at* | Branch, tag, or commit to use | *revision* (`master`) | `at:v1.5.6` @@ -338,6 +338,11 @@ zplug "b4b4r07/hello_bitbucket", \ hook-build:"chmod 755 *.sh", \ use:"*.sh" +# Support Gitlab +zplug "willemmali-sh/chegit", \ + as:command, \ + from:gitlab + # Group dependencies, emoji-cli depends on jq in this example zplug "stedolan/jq", \ as:command, \ diff --git a/misc/completions/_zplug b/misc/completions/_zplug index 6a33556..39e8363 100644 --- a/misc/completions/_zplug +++ b/misc/completions/_zplug @@ -102,7 +102,7 @@ case "$words[1]" in _values -S : -s , "zplug tags" \ "as[Specify whether to register as commands or to register as plugins]:as:(plugin command)" \ "use[Specify the pattern to source (for plugin) or relative path to export (for command)]:use:->use" \ - "from[Specify the services you use to install]:from:(gh-r gist oh-my-zsh github bitbucket local)" \ + "from[Specify the services you use to install]:from:(gh-r gist oh-my-zsh github bitbucket gitlab local)" \ "at[Support branch/tag installation]:at:" \ "rename-to[Specify filename you want to rename]:rename-to:" \ "dir[Installation directory (RO)]:dir:->dir" \