Commit f967a0d3 authored by Bruno's avatar Bruno

Merge pull request #125 from derekstavis/fix-bundle-install

Rewrite bundle install to conform with latest `omf.install` interface
parents d16796b6 d224e015
...@@ -2,30 +2,28 @@ function omf.bundle.install ...@@ -2,30 +2,28 @@ function omf.bundle.install
set bundle $OMF_CONFIG/bundle set bundle $OMF_CONFIG/bundle
if test -f $bundle if test -f $bundle
set packages (omf.packages.list --installed --plugin) set packages (omf.packages.list --installed)
set themes (omf.packages.list --installed --theme)
set bundle_contents (cat $bundle | sort -u) set bundle_contents (cat $bundle | sort -u)
for record in $bundle_contents for record in $bundle_contents
set type (echo $record | cut -d' ' -f1) test -n "$record"; or continue
set name_or_url (echo $record | cut -d' ' -f2-)
set type (echo $record | cut -s -d' ' -f1 | sed 's/ //g')
contains $type theme package; or continue
set name_or_url (echo $record | cut -s -d' ' -f2- | sed 's/ //g')
test -n "$name_or_url"; or continue
set name (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//') set name (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//')
switch $type
case "package"
if not contains $name $packages if not contains $name $packages
omf.install --pkg $name_or_url omf.install $name_or_url;
end and set installed
case "theme"
if not contains $name $themes
omf.install --theme $name_or_url
end
end end
end end
sort -u $bundle -o $bundle sort -u $bundle -o $bundle
end end
return 0 set -q installed
end end
...@@ -76,16 +76,17 @@ function omf -d "Oh My Fish" ...@@ -76,16 +76,17 @@ function omf -d "Oh My Fish"
case "i" "install" "get" case "i" "install" "get"
if test (count $argv) -eq 1 if test (count $argv) -eq 1
omf.bundle.install omf.bundle.install;
and set installed
else else
for package in $argv[2..-1] for package in $argv[2..-1]
if omf.install $package omf.install $package;
set refresh and set installed
end end
end end
set -q refresh; and refresh set -q installed; and refresh
end return 0
case "l" "ls" "list" case "l" "ls" "list"
omf.packages.list --installed | column omf.packages.list --installed | column
......
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