using events for easier verbosity handling

pull/2/head
Bruno Pinto 9 years ago
parent 2930c81228
commit bcd032de8e

@ -52,10 +52,14 @@ function omf.packages --argument-names options -d 'Manage all plugins and themes
end
end
function omf.packages.report.started -e omf_package_installing -e omf_package_updating
function omf.packages.report.installing -e omf_package_installing
omf.log -n white "Installing $argv... "
end
function omf.packages.report.updating -e omf_package_updating
omf.log -n white "Updating $argv... "
end
function omf.packages.report.finished -e omf_package_installed -e omf_package_updated
omf.log green "√"
set __omf_packages_modified (expr $__omf_packages_modified + 1)

@ -12,7 +12,7 @@ function omf.packages.install --argument-names type name -d "Install a plugin or
switch $type
case '--plugin'
if [ -e $fish_path/plugins/$name -o -e $fish_custom/plugins/$name ]
#echo "$plugin is already installed. Skipping."
# Plugin is already installed. Skipping.
else
emit omf_package_installing $name
git clone "https://github.com/oh-my-fish/plugin-$name" $fish_path/plugins/$name ^ /dev/null
@ -20,7 +20,7 @@ function omf.packages.install --argument-names type name -d "Install a plugin or
end
case '--theme'
if [ -e $fish_path/themes/$name -o -e $fish_custom/themes/$name ]
#echo "$fish_theme is already installed. Skipping."
# Theme is already installed. Skipping.
else
emit omf_package_installing $name
git clone "https://github.com/oh-my-fish/theme-$name" $fish_path/themes/$name ^ /dev/null

@ -14,34 +14,30 @@ function omf.packages.update --argument-names type name -d "Update a plugin or t
switch $type
case '--plugin'
if [ -e $fish_path/plugins/$name -a -e $fish_path/plugins/$name/.git ]
omf.log -n white "Updating $name "
emit omf_package_updating $name
echo (cd $fish_path/plugins/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√"
emit omf_package_updated
emit omf_package_updated $name
else
if [ -e $fish_custom/plugins/$name -a -e $fish_custom/plugins/$name/.git ]
omf.log -n white "Updating $name "
emit omf_package_updating $name
echo (cd $fish_custom/plugins/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√"
emit omf_package_updated
emit omf_package_updated $name
else
#echo "Plugin is not installed or not a git repo. Skipping."
# Plugin is not installed or not a git repo. Skipping.
end
end
case '--theme'
if [ -e $fish_path/themes/$name -a -e $fish_path/themes/$name/.git ]
omf.log -n white "Updating $name "
emit omf_package_updating $name
echo (cd $fish_path/themes/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√"
emit omf_package_updated
emit omf_package_updated $name
else
if [ -e $fish_custom/themes/$name -a -e $fish_custom/themes/$name/.git ]
omf.log -n white "Updating $name "
emit omf_package_updating $name
echo (cd $fish_custom/themes/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√"
emit omf_package_updated
emit omf_package_updated $name
else
#echo "Theme is not installed or not a git repo. Skipping."
# Theme is not installed or not a git repo. Skipping.
end
end
case '*'

Loading…
Cancel
Save