From 8ae139dc9ef4328c89240ada6d9421d2fc0d235d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Franke?= Date: Sat, 30 Jan 2021 13:25:31 +0100 Subject: [PATCH 1/3] Add GitLab support. Add the possibility to add plugins from gitlab. Resolves #657. --- README.md | 6 ++++++ functions/fisher.fish | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index ab9f6de..1aa9814 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ Install plugins using the `install` command followed by the path to the reposito fisher install ilancosman/tide ``` +To install a plugin from GitLab, prefix `gitlab.com/`. + +```console +fisher install gitlab.com/ainmosni/fish-aws +``` + To get a specific version of a plugin add an `@` symbol after the plugin name followed by a tag, branch, or [commit](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefcommit-ishacommit-ishalsocommittish). ```console diff --git a/functions/fisher.fish b/functions/fisher.fish index 374be54..90b826d 100644 --- a/functions/fisher.fish +++ b/functions/fisher.fish @@ -84,6 +84,12 @@ function fisher --argument-names cmd --description "A plugin manager for Fish" set name (string split \@ $plugin) || set name[2] HEAD set url https://codeload.github.com/\$name[1]/tar.gz/\$name[2] + if string match -q 'gitlab.com/*' \$name[1] + set bare (string replace 'gitlab.com/' '' \$name[1]) + set repo (string split '/' \$bare) + set url https://gitlab.com/{\$bare}/-/archive/{\$name[2]}/{\$repo[1]}-{\$name[2]}.tar.gz + end + echo Fetching (set_color --underline)\$url(set_color normal) if curl --silent \$url | tar --extract --gzip --directory \$temp --file - 2>/dev/null From 6cc13ada7ebc81d7245f5cdd847de66b6df5111c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Franke?= Date: Sat, 30 Jan 2021 13:51:54 +0100 Subject: [PATCH 2/3] Replace the username with the actual repo name. Even though this did work, it's not correct. This makes the URL fully correct. --- functions/fisher.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fisher.fish b/functions/fisher.fish index 90b826d..e142800 100644 --- a/functions/fisher.fish +++ b/functions/fisher.fish @@ -87,7 +87,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish" if string match -q 'gitlab.com/*' \$name[1] set bare (string replace 'gitlab.com/' '' \$name[1]) set repo (string split '/' \$bare) - set url https://gitlab.com/{\$bare}/-/archive/{\$name[2]}/{\$repo[1]}-{\$name[2]}.tar.gz + set url https://gitlab.com/{\$bare}/-/archive/{\$name[2]}/{\$repo[2]}-{\$name[2]}.tar.gz end echo Fetching (set_color --underline)\$url(set_color normal) From a0a68de91999dbd6e15587cb8e76b972e101d07b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Franke?= Date: Mon, 1 Feb 2021 10:05:55 +0100 Subject: [PATCH 3/3] Adjust the gitlab documention. Make it a bit less verbose. --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 1aa9814..b6326d9 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,7 @@ Install plugins using the `install` command followed by the path to the reposito fisher install ilancosman/tide ``` -To install a plugin from GitLab, prefix `gitlab.com/`. - -```console -fisher install gitlab.com/ainmosni/fish-aws -``` +> To install a plugin from GitLab, prefix the repository with `gitlab.com/`. To get a specific version of a plugin add an `@` symbol after the plugin name followed by a tag, branch, or [commit](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefcommit-ishacommit-ishalsocommittish).