oh-my-fish/pkg/omf/functions/bundle/omf.bundle.remove.fish

28 lines
710 B
Fish
Raw Normal View History

function omf.bundle.remove
2016-04-19 00:34:33 -07:00
if test -L $OMF_CONFIG/bundle
2016-04-19 00:14:10 -07:00
set bundle (readlink $OMF_CONFIG/bundle)
else
set bundle $OMF_CONFIG/bundle
end
if test -f $bundle
set type $argv[1]
set name $argv[2]
set bundle_contents (cat $bundle | sort -u)
rm -f $bundle
for record in $bundle_contents
set record_type (echo $record | cut -d' ' -f1)
2015-12-25 18:02:44 +02:00
set record_name_or_url (echo $record | cut -d' ' -f2-)
set record_name (omf.packages.name $record_name_or_url)
2015-12-25 18:02:44 +02:00
if not test "$type" = "$record_type" -a "$name" = "$record_name"
echo "$record_type $record_name_or_url" >> $bundle
end
end
end
2015-09-11 14:52:04 -03:00
return 0
end