oh-my-fish/plugins/omf/omf.packages.fish

77 lines
1.9 KiB
Fish
Raw Normal View History

2015-05-26 21:48:21 +08:00
# NAME
2015-05-31 19:31:55 +08:00
# omf.packages - Manage all plugins and themes
2015-05-26 21:48:21 +08:00
#
# SYNOPSIS
2015-05-31 19:31:55 +08:00
# omf.packages [OPTIONS]
2015-05-26 21:48:21 +08:00
#
# OPTIONS
# --install
# Install all packages
# --update
# Update all packages
2015-05-31 20:29:05 +08:00
# --list
# List all active packages
2015-05-26 21:48:21 +08:00
#
# DESCRIPTION
# Manage all plugins and themes specified on the $fish_plugins
# and $fish_theme variables
#
2015-05-31 19:31:55 +08:00
function omf.packages --argument-names options -d 'Manage all plugins and themes'
2015-05-31 20:29:05 +08:00
set -g __omf_packages_modified 0
2015-05-26 21:48:21 +08:00
switch $options
2015-05-31 20:29:05 +08:00
case '--install'
for plugin in $fish_plugins
omf.packages.install --plugin $plugin
end
omf.packages.install --theme $fish_theme
if [ $__omf_packages_modified -eq 0 ]
omf.log green 'All packages were already installed.'
end
case '--update'
for plugin in $fish_plugins
omf.packages.update --plugin $plugin
end
omf.packages.update --theme $fish_theme
if [ $__omf_packages_modified -eq 0 ]
omf.log green 'All packages were already updated'
end
case '--list'
omf.log yellow 'Plugins: '
omf.log normal $fish_plugins
omf.log normal ''
omf.log yellow 'Theme: '
omf.log normal $fish_theme
case '*'
2015-05-31 19:31:55 +08:00
omf.log red 'Unknown option'
2015-05-26 21:48:21 +08:00
end
end
2015-05-31 20:29:05 +08:00
function omf.packages.report.installing -e omf_package_installing
2015-05-31 20:29:05 +08:00
omf.log -n white "Installing $argv... "
end
function omf.packages.report.updating -e omf_package_updating
omf.log -n white "Updating $argv... "
end
2015-05-31 21:24:22 +08:00
function omf.packages.report.failed -e omf_package_install_failed -e omf_package_update_failed
omf.log red "✖"
set_color yellow
cat /tmp/oh-my-fish.clone.log
set_color normal
set __omf_packages_modified (expr $__omf_packages_modified + 1)
end
2015-05-31 20:29:05 +08:00
function omf.packages.report.finished -e omf_package_installed -e omf_package_updated
2015-05-31 21:24:22 +08:00
omf.log green "✔"
2015-05-31 20:29:05 +08:00
set __omf_packages_modified (expr $__omf_packages_modified + 1)
end