Commit fa24e676 authored by Itzik Ephraim's avatar Itzik Ephraim

Allow selective updates

parent a0c6213b
...@@ -33,10 +33,15 @@ fish install ...@@ -33,10 +33,15 @@ fish install
Oh My Fish includes a small utility `omf` to fetch and install new packages and themes. Oh My Fish includes a small utility `omf` to fetch and install new packages and themes.
#### `omf update` #### `omf update` _`[omf]`_ _`[<package>...]`_
Update the framework and installed packages. Update the framework and installed packages.
- When called without arguments, update core and all installed packages.
- You can choose to update only the core, by running `omf update omf`.
- 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` _`[<name>|<url>]`_ #### `omf install` _`[<name>|<url>]`_
Install one _or more_ packages. Install one _or more_ packages.
......
function omf.cli.update function omf.cli.update
if omf.core.update set -l update_core
echo (omf::em)"Oh My Fish is up to date."(omf::off) set -l packages $argv
if test (count $packages) -gt 0
# If several packages are listed, only update core if "omf" is listed among them.
# Also keep "omf" out of the list of packages to update.
set index (contains -i -- omf $packages)
and set -e packages[$index]
or set -e update_core
else else
echo (omf::err)"Oh My Fish failed to update."(omf::off) set packages (omf.packages.list --installed)
echo "Please open a new issue here → "(omf::em)"github.com/oh-my-fish/oh-my-fish/issues"(omf::off)
end end
for package in (omf.packages.list --installed) if set -q update_core
if omf.core.update
echo (omf::em)"Oh My Fish is up to date."(omf::off)
else
echo (omf::err)"Oh My Fish failed to update."(omf::off)
echo "Please open a new issue here → "(omf::em)"github.com/oh-my-fish/oh-my-fish/issues"(omf::off)
end
end
for package in $packages
omf.packages.update $package omf.packages.update $package
end end
end end
...@@ -59,7 +59,7 @@ function omf -d "Oh My Fish" ...@@ -59,7 +59,7 @@ function omf -d "Oh My Fish"
omf.cli.theme $arguments omf.cli.theme $arguments
case "u" "update" case "u" "update"
omf.cli.update omf.cli.update $arguments
case "*" case "*"
echo (omf::err)"$argv[1] option not recognized"(omf::off) 1^&2 echo (omf::err)"$argv[1] option not recognized"(omf::off) 1^&2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment