mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-02-21 10:46:40 +08:00

This commit adds an improved reload code for Oh My Fish, besides saving the history now the reloading technique keeps directory history and stack and clears fish_greeting, for a transparent transition. The reloading code is now safe regarding to background jobs. exec wipes fish job control, so the user-facing code under the (just- introduced by this commit) `omf reload` command is kept safe by a warning. For testing purposes, `omf update` and `omf remove` rolls automatic refresh only when `OMF_AUTO_RELOAD` variable is set. Recap of the commit: - Add improved reload code (omf.reload) - Add a safe reload code (omf.cli.reload) - Add `omf reload` command - Add opt-in reload to `omf update` and `omf remove` commands
31 lines
865 B
Fish
31 lines
865 B
Fish
function omf.cli.update
|
|
set -l update_core
|
|
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
|
|
set packages (omf.packages.list --installed)
|
|
end
|
|
|
|
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
|
|
end
|
|
|
|
# Opt-in flag for testing
|
|
set -q OMF_AUTO_RELOAD
|
|
and omf.cli.reload
|
|
end
|