You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oh-my-fish/pkg/omf/functions/bundle/omf.bundle.install.fish

39 lines
972 B
Fish

function omf.bundle.install
test -n "$argv";
and set bundle $argv
or set bundle $OMF_CONFIG/bundle
if test -f $bundle
set packages (omf.packages.list)
set bundle_contents (cat $bundle | sort -u)
for record in $bundle_contents
test -n "$record"; or continue
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 (omf.packages.name $name_or_url)
if not contains $name $packages
omf.packages.install $name_or_url;
and begin
test $type = package
and begin
require $name
or echo "Failed to require package: $name"
end
or true
end
or set error
end
end
sort -u $bundle -o $bundle
end
not set -q error
end