handling failures on git clone

This commit is contained in:
Bruno Pinto 2015-05-31 14:24:22 +01:00
parent bcd032de8e
commit d3b4007594
2 changed files with 26 additions and 6 deletions

View File

@ -60,7 +60,17 @@ function omf.packages.report.updating -e omf_package_updating
omf.log -n white "Updating $argv... " omf.log -n white "Updating $argv... "
end end
function omf.packages.report.finished -e omf_package_installed -e omf_package_updated function omf.packages.report.failed -e omf_package_install_failed -e omf_package_update_failed
omf.log green "√" 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
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) set __omf_packages_modified (expr $__omf_packages_modified + 1)
end end

View File

@ -15,16 +15,26 @@ function omf.packages.install --argument-names type name -d "Install a plugin or
# 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 --quiet "https://github.com/oh-my-fish/plugin-$name" $fish_path/plugins/$name ^ /tmp/oh-my-fish.clone.log
emit omf_package_installed $name
if [ $status -eq 0 ]
emit omf_package_installed $name
else
emit omf_package_install_failed $name
end
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 ]
# 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 --quiet "https://github.com/oh-my-fish/theme-$name" $fish_path/themes/$name ^ /tmp/oh-my-fish.clone.log
emit omf_package_installed $name
if [ $status -eq 0 ]
emit omf_package_installed $name
else
emit omf_package_install_failed $name
end
end end
case '*' case '*'
omf.log red 'Unknown option' omf.log red 'Unknown option'