Commit d224e015 authored by Derek Stavis's avatar Derek Stavis

omf.bundle.install: Fix #123 by rewriting the code

Rewrites the code, as now `omf.install` is type
agnostic, and any -- preceded parameter will
be interpreted as package name.
parent c4bd4ade
...@@ -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 name (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//') set type (echo $record | cut -s -d' ' -f1 | sed 's/ //g')
contains $type theme package; or continue
switch $type set name_or_url (echo $record | cut -s -d' ' -f2- | sed 's/ //g')
case "package" test -n "$name_or_url"; or continue
if not contains $name $packages
omf.install --pkg $name_or_url set name (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//')
end
case "theme" if not contains $name $packages
if not contains $name $themes omf.install $name_or_url;
omf.install --theme $name_or_url and set installed
end
end end
end end
sort -u $bundle -o $bundle sort -u $bundle -o $bundle
end end
return 0 set -q installed
end end
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