oh-my-fish/pkg/omf/cli/omf.bundle.install.fish

32 lines
763 B
Fish
Raw Normal View History

function omf.bundle.install
set bundle $OMF_CONFIG/bundle
2015-08-30 06:22:53 +08:00
if test -f $bundle
2015-08-30 06:22:53 +08:00
set packages (omf.list_local_packages)
set themes (omf.list_installed_themes)
set bundle_contents (cat $bundle | sort -u)
2015-08-30 06:22:53 +08:00
for record in $bundle_contents
2015-08-30 06:22:53 +08:00
set type (echo $record | cut -d' ' -f1)
set name_or_url (echo $record | cut -d' ' -f2-)
set name (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//')
2015-08-30 06:22:53 +08:00
switch $type
case "package"
if not contains $name $packages
omf.install --pkg $name_or_url
2015-08-30 06:22:53 +08:00
end
case "theme"
if not contains $name $themes
omf.install --theme $name_or_url
2015-08-30 06:22:53 +08:00
end
end
end
sort -u $bundle -o $bundle
2015-08-30 06:22:53 +08:00
end
return 0
end