Commit 5e034ebc authored by Derek Willian Stavis's avatar Derek Willian Stavis

Merge pull request #43 from oh-my-fish/bundle/uniqueize

bundle: make contents unique when adding and installing bundle
parents 0e68052a de9955e0
......@@ -10,6 +10,8 @@ function omf.bundle.add -a type name_or_url
else
echo $record > $bundle
end
sort -u $bundle -o $bundle
end
function __omf.write_theme
......
function omf.bundle.install
set bundle $OMF_CONFIG/bundle
if test -f $OMF_CONFIG/bundle
if test -f $bundle
set packages (omf.list_local_packages)
set themes (omf.list_installed_themes)
set bundle_contents (cat $bundle | sort -u)
for record in (cat $OMF_CONFIG/bundle | uniq)
for record in $bundle_contents
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-//')
......@@ -20,8 +22,9 @@ function omf.bundle.install
omf.install --theme $name
end
end
end
sort -u $bundle -o $bundle
end
return 0
......
......@@ -4,7 +4,7 @@ function omf.bundle.remove
if test -f $bundle
set type $argv[1]
set name $argv[2]
set bundle_contents (cat $bundle | uniq)
set bundle_contents (cat $bundle | sort -u)
rm -f $bundle
......@@ -17,7 +17,8 @@ function omf.bundle.remove
if not test "$type" = "$record_type" -a "$name" = "$record_basename"
echo "$record_type $record_name" >> $bundle
end
end
end
return 0
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