packages: allow installing with github 'user/repo'

pull/894/head
fdeitylink 3 years ago committed by Pablo Aguiar
parent 0cda2c0c1f
commit 029a67518d

@ -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 - 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. update. You may still include "omf" in the list to update the core as well.
#### `omf install` _`[<name>|<url>]`_ #### `omf install` _`[<name>|<url>|<user/repo>]`_
Install one _or more_ packages. Install one _or more_ packages.
- You can install packages directly by URL via `omf install URL` - 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). - When called without arguments, install missing packages from [bundle](#dotfiles).
#### `omf repositories` _`[list|add|remove]`_ #### `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` _`<name>`_ #### `omf remove` _`<name>`_
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. > 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.

@ -18,8 +18,12 @@ function omf.packages.install -a name_or_url
set branch $props[3] set branch $props[3]
else else
set name (omf.packages.name $name_or_url) set name (omf.packages.name $name_or_url)
set url $name_or_url
set branch "" 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 end
if contains -- $name (omf.packages.list) if contains -- $name (omf.packages.list)

Loading…
Cancel
Save