Commit bcd032de authored by Bruno Pinto's avatar Bruno Pinto

using events for easier verbosity handling

parent 2930c812
...@@ -52,10 +52,14 @@ function omf.packages --argument-names options -d 'Manage all plugins and themes ...@@ -52,10 +52,14 @@ function omf.packages --argument-names options -d 'Manage all plugins and themes
end end
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... " omf.log -n white "Installing $argv... "
end 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 function omf.packages.report.finished -e omf_package_installed -e omf_package_updated
omf.log green "√" omf.log green "√"
set __omf_packages_modified (expr $__omf_packages_modified + 1) 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 ...@@ -12,7 +12,7 @@ function omf.packages.install --argument-names type name -d "Install a plugin or
switch $type switch $type
case '--plugin' case '--plugin'
if [ -e $fish_path/plugins/$name -o -e $fish_custom/plugins/$name ] if [ -e $fish_path/plugins/$name -o -e $fish_custom/plugins/$name ]
#echo "$plugin is already installed. Skipping." # Plugin is already installed. Skipping.
else else
emit omf_package_installing $name emit omf_package_installing $name
git clone "https://github.com/oh-my-fish/plugin-$name" $fish_path/plugins/$name ^ /dev/null 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 ...@@ -20,7 +20,7 @@ function omf.packages.install --argument-names type name -d "Install a plugin or
end end
case '--theme' case '--theme'
if [ -e $fish_path/themes/$name -o -e $fish_custom/themes/$name ] 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 else
emit omf_package_installing $name emit omf_package_installing $name
git clone "https://github.com/oh-my-fish/theme-$name" $fish_path/themes/$name ^ /dev/null 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 ...@@ -14,34 +14,30 @@ function omf.packages.update --argument-names type name -d "Update a plugin or t
switch $type switch $type
case '--plugin' case '--plugin'
if [ -e $fish_path/plugins/$name -a -e $fish_path/plugins/$name/.git ] 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 echo (cd $fish_path/plugins/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√" emit omf_package_updated $name
emit omf_package_updated
else else
if [ -e $fish_custom/plugins/$name -a -e $fish_custom/plugins/$name/.git ] 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 echo (cd $fish_custom/plugins/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√" emit omf_package_updated $name
emit omf_package_updated
else else
#echo "Plugin is not installed or not a git repo. Skipping." # Plugin is not installed or not a git repo. Skipping.
end end
end end
case '--theme' case '--theme'
if [ -e $fish_path/themes/$name -a -e $fish_path/themes/$name/.git ] 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 echo (cd $fish_path/themes/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√" emit omf_package_updated $name
emit omf_package_updated
else else
if [ -e $fish_custom/themes/$name -a -e $fish_custom/themes/$name/.git ] 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 echo (cd $fish_custom/themes/$name; and git pull --rebase > /dev/null) >/dev/null
omf.log green "√" emit omf_package_updated $name
emit omf_package_updated
else else
#echo "Theme is not installed or not a git repo. Skipping." # Theme is not installed or not a git repo. Skipping.
end end
end end
case '*' case '*'
......
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