Skip to content
Snippets Groups Projects
Commit 5e034ebc authored by Derek Willian Stavis's avatar Derek Willian Stavis
Browse files

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

bundle: make contents unique when adding and installing bundle
parents 0e68052a de9955e0
Branches
No related merge requests found
...@@ -10,6 +10,8 @@ function omf.bundle.add -a type name_or_url ...@@ -10,6 +10,8 @@ function omf.bundle.add -a type name_or_url
else else
echo $record > $bundle echo $record > $bundle
end end
sort -u $bundle -o $bundle
end end
function __omf.write_theme function __omf.write_theme
......
function omf.bundle.install 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 packages (omf.list_local_packages)
set themes (omf.list_installed_themes) 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 type (echo $record | cut -d' ' -f1)
set name_or_url (echo $record | cut -d' ' -f2-) 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 name (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//')
...@@ -20,8 +22,9 @@ function omf.bundle.install ...@@ -20,8 +22,9 @@ function omf.bundle.install
omf.install --theme $name omf.install --theme $name
end end
end end
end end
sort -u $bundle -o $bundle
end end
return 0 return 0
......
...@@ -4,7 +4,7 @@ function omf.bundle.remove ...@@ -4,7 +4,7 @@ function omf.bundle.remove
if test -f $bundle if test -f $bundle
set type $argv[1] set type $argv[1]
set name $argv[2] set name $argv[2]
set bundle_contents (cat $bundle | uniq) set bundle_contents (cat $bundle | sort -u)
rm -f $bundle rm -f $bundle
...@@ -17,7 +17,8 @@ function omf.bundle.remove ...@@ -17,7 +17,8 @@ function omf.bundle.remove
if not test "$type" = "$record_type" -a "$name" = "$record_basename" if not test "$type" = "$record_type" -a "$name" = "$record_basename"
echo "$record_type $record_name" >> $bundle echo "$record_type $record_name" >> $bundle
end end
end end
end end
return 0
end end
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