mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-23 15:07:31 +08:00
Merge pull request #210 from oranja/omf-package-prefix
Support omf- prefix for packages
This commit is contained in:
commit
a1856c71b1
|
@ -16,7 +16,7 @@ function omf.bundle.install
|
|||
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-//')
|
||||
set name (omf.package_name $name_or_url)
|
||||
|
||||
if not contains $name $packages
|
||||
omf.install $name_or_url;
|
||||
|
|
|
@ -10,12 +10,11 @@ function omf.bundle.remove
|
|||
|
||||
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-//')
|
||||
set record_name_or_url (echo $record | cut -d' ' -f2-)
|
||||
set record_name (omf.package_name $record_name_or_url)
|
||||
|
||||
if not test "$type" = "$record_type" -a "$name" = "$record_basename"
|
||||
echo "$record_type $record_name" >> $bundle
|
||||
if not test "$type" = "$record_type" -a "$name" = "$record_name"
|
||||
echo "$record_type $record_name_or_url" >> $bundle
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,9 +17,9 @@ function omf.install -a name_or_url
|
|||
|
||||
if test -e $OMF_PATH/db/$parent_path/$name_or_url
|
||||
set name $name_or_url
|
||||
set url (cat $OMF_PATH/db/$parent_path/$name_or_url)
|
||||
set url (cat $OMF_PATH/db/$parent_path/$name)
|
||||
else
|
||||
set name (basename $name_or_url | sed 's/^pkg-//;s/^plugin-//;s/^theme-//;s/\.git$//')
|
||||
set name (omf.package_name $name_or_url)
|
||||
set url $name_or_url
|
||||
end
|
||||
|
||||
|
|
3
pkg/omf/util/omf.package_name.fish
Normal file
3
pkg/omf/util/omf.package_name.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function omf.package_name -a name_or_url
|
||||
basename $name_or_url | sed -E 's/^(omf-)?((plugin|pkg|theme)-)?//;s/.git$//'
|
||||
end
|
Loading…
Reference in New Issue
Block a user