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

43 lines
1.3 KiB
Fish
Raw Normal View History

2015-05-26 21:48:21 +08:00
# NAME
2015-05-31 20:29:05 +08:00
# omf.packages.install - Install a plugin or theme
#
# SYNOPSIS
# --plugin <plugin_name>
# --theme <theme_name>
2015-05-26 21:48:21 +08:00
#
# DESCRIPTION
2015-05-31 20:29:05 +08:00
# Install a plugin or theme
2015-05-26 21:48:21 +08:00
#
2015-05-31 20:29:05 +08:00
function omf.packages.install --argument-names type name -d "Install a plugin or theme"
switch $type
case '--plugin'
if [ -e $fish_path/plugins/$name -o -e $fish_custom/plugins/$name ]
# Plugin is already installed. Skipping.
2015-05-31 20:29:05 +08:00
else
emit omf_package_installing $name
2015-05-31 21:24:22 +08:00
git clone --quiet "https://github.com/oh-my-fish/plugin-$name" $fish_path/plugins/$name ^ /tmp/oh-my-fish.clone.log
if [ $status -eq 0 ]
emit omf_package_installed $name
else
emit omf_package_install_failed $name
end
2015-05-31 20:29:05 +08:00
end
case '--theme'
if [ -e $fish_path/themes/$name -o -e $fish_custom/themes/$name ]
# Theme is already installed. Skipping.
2015-05-31 20:29:05 +08:00
else
emit omf_package_installing $name
2015-05-31 21:24:22 +08:00
git clone --quiet "https://github.com/oh-my-fish/theme-$name" $fish_path/themes/$name ^ /tmp/oh-my-fish.clone.log
if [ $status -eq 0 ]
emit omf_package_installed $name
else
emit omf_package_install_failed $name
end
2015-05-31 20:29:05 +08:00
end
case '*'
omf.log red 'Unknown option'
2015-05-26 21:48:21 +08:00
end
end