From 029a67518d5c4aed8f84eeeaa2133d5c513ca86c Mon Sep 17 00:00:00 2001 From: fdeitylink <11952260+fdeitylink@users.noreply.github.com> Date: Tue, 2 Mar 2021 17:41:14 -0500 Subject: [PATCH] packages: allow installing with github 'user/repo' --- README.md | 5 +++-- pkg/omf/functions/packages/omf.packages.install.fish | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e006f05..7b5d127 100644 --- a/README.md +++ b/README.md @@ -86,11 +86,12 @@ Update Oh My Fish, all package repositories, and all installed packages. - For selective package update, list only the names of packages you wish to update. You may still include "omf" in the list to update the core as well. -#### `omf install` _`[|]`_ +#### `omf install` _`[||]`_ Install one _or more_ packages. - You can install packages directly by URL via `omf install URL` +- You can install packages from a GitHub repository via `omf install user/repo` - When called without arguments, install missing packages from [bundle](#dotfiles). #### `omf repositories` _`[list|add|remove]`_ @@ -107,7 +108,7 @@ Apply a theme. To list available themes, type `omf theme`. You can also [preview #### `omf remove` _``_ -Remove a theme or package. +Remove a theme or package. If a package was installed via `user/repo`, use `repo` for `name`. > Packages can use uninstall hooks, so custom cleanup of resources can be done when uninstalling it. See [Uninstall](/docs/en-US/Packages.md#uninstall) for more information. diff --git a/pkg/omf/functions/packages/omf.packages.install.fish b/pkg/omf/functions/packages/omf.packages.install.fish index e7f03f5..7d7ceb8 100644 --- a/pkg/omf/functions/packages/omf.packages.install.fish +++ b/pkg/omf/functions/packages/omf.packages.install.fish @@ -18,8 +18,12 @@ function omf.packages.install -a name_or_url set branch $props[3] else set name (omf.packages.name $name_or_url) - set url $name_or_url set branch "" + if string match -qi -r "^[a-z\d-]+/[a-z\d\-\._]+\$" $name_or_url + set url "https://github.com/$name_or_url" + else + set url $name_or_url + end end if contains -- $name (omf.packages.list)