Merge pull request #25 from oh-my-fish/split-bundle
bundle: move related functions to omf.bundle namespacepull/35/head
commit
d2abe92a36
@ -1,4 +1,4 @@
|
||||
function omf.persist -a type name_or_url
|
||||
function omf.bundle.add -a type name_or_url
|
||||
function __omf.write_bundle
|
||||
set -l bundle $OMF_CONFIG/bundle
|
||||
set -l record $argv
|
@ -1,21 +1,22 @@
|
||||
function omf.install_bundle
|
||||
function omf.bundle.install
|
||||
|
||||
if test -f $OMF_CONFIG/bundle
|
||||
set packages (omf.list_local_packages)
|
||||
set themes (omf.list_installed_themes)
|
||||
|
||||
for record in (cat $OMF_CONFIG/bundle)
|
||||
for record in (cat $OMF_CONFIG/bundle | uniq)
|
||||
set type (echo $record | cut -d' ' -f1)
|
||||
set name (echo $record | cut -d' ' -f2- | sed -e 's/\.git//')
|
||||
set name_or_url (echo $record | cut -d' ' -f2-)
|
||||
set name (basename $name_or_url | sed 's/\.git//;s/^pkg-//;s/^plugin-//;s/^theme-//')
|
||||
|
||||
switch $type
|
||||
case "package"
|
||||
if not contains (basename $name) $packages
|
||||
if not contains $name $packages
|
||||
omf.install --pkg $name
|
||||
end
|
||||
|
||||
case "theme"
|
||||
if not contains (basename $name) $themes
|
||||
if not contains $name $themes
|
||||
omf.install --theme $name
|
||||
end
|
||||
end
|
@ -0,0 +1,23 @@
|
||||
function omf.bundle.remove
|
||||
set bundle $OMF_CONFIG/bundle
|
||||
|
||||
if test -f $bundle
|
||||
set type $argv[1]
|
||||
set name $argv[2]
|
||||
set bundle_contents (cat $bundle | uniq)
|
||||
|
||||
rm -f $bundle
|
||||
|
||||
for record in $bundle_contents
|
||||
set record_type (echo $record | cut -d' ' -f1)
|
||||
set record_name (echo $record | cut -d' ' -f2-)
|
||||
set record_basename (basename (echo $record_name | \
|
||||
sed -e 's/\.git$//') | sed 's/^pkg-//;s/^plugin-//;s/^theme-//')
|
||||
|
||||
if not test "$type" = "$record_type" -a "$name" = "$record_basename"
|
||||
echo "$record_type $record_name" >> $bundle
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue