mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-23 02:09:27 +08:00
Merge pull request #125 from derekstavis/fix-bundle-install
Rewrite bundle install to conform with latest `omf.install` interface
This commit is contained in:
commit
f967a0d334
|
@ -2,30 +2,28 @@ function omf.bundle.install
|
|||
set bundle $OMF_CONFIG/bundle
|
||||
|
||||
if test -f $bundle
|
||||
set packages (omf.packages.list --installed --plugin)
|
||||
set themes (omf.packages.list --installed --theme)
|
||||
set packages (omf.packages.list --installed)
|
||||
set bundle_contents (cat $bundle | sort -u)
|
||||
|
||||
for record in $bundle_contents
|
||||
set type (echo $record | cut -d' ' -f1)
|
||||
set name_or_url (echo $record | cut -d' ' -f2-)
|
||||
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 (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//')
|
||||
|
||||
switch $type
|
||||
case "package"
|
||||
if not contains $name $packages
|
||||
omf.install --pkg $name_or_url
|
||||
end
|
||||
|
||||
case "theme"
|
||||
if not contains $name $themes
|
||||
omf.install --theme $name_or_url
|
||||
end
|
||||
if not contains $name $packages
|
||||
omf.install $name_or_url;
|
||||
and set installed
|
||||
end
|
||||
end
|
||||
|
||||
sort -u $bundle -o $bundle
|
||||
end
|
||||
|
||||
return 0
|
||||
set -q installed
|
||||
end
|
||||
|
|
|
@ -76,17 +76,18 @@ function omf -d "Oh My Fish"
|
|||
|
||||
case "i" "install" "get"
|
||||
if test (count $argv) -eq 1
|
||||
omf.bundle.install
|
||||
omf.bundle.install;
|
||||
and set installed
|
||||
else
|
||||
for package in $argv[2..-1]
|
||||
if omf.install $package
|
||||
set refresh
|
||||
end
|
||||
omf.install $package;
|
||||
and set installed
|
||||
end
|
||||
|
||||
set -q refresh; and refresh
|
||||
end
|
||||
|
||||
set -q installed; and refresh
|
||||
return 0
|
||||
|
||||
case "l" "ls" "list"
|
||||
omf.packages.list --installed | column
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user