diff --git a/pkg/omf/cli/omf.bundle.install.fish b/pkg/omf/cli/omf.bundle.install.fish index 908dad2478eeaf923c7a211347d091ce8b949022..94549ebefa7b781701933c80bac4ca23fc1375a7 100644 --- a/pkg/omf/cli/omf.bundle.install.fish +++ b/pkg/omf/cli/omf.bundle.install.fish @@ -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; diff --git a/pkg/omf/cli/omf.bundle.remove.fish b/pkg/omf/cli/omf.bundle.remove.fish index 1006238a60a39819dbfb4e41c32540bede97245f..cc2bdadb2c2f68236cab11c0368658bda745886e 100644 --- a/pkg/omf/cli/omf.bundle.remove.fish +++ b/pkg/omf/cli/omf.bundle.remove.fish @@ -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 diff --git a/pkg/omf/cli/omf.install.fish b/pkg/omf/cli/omf.install.fish index 1fb77d6aa84f3ad45a6e67ab601435d64a5dea53..ec48524bb43b2a238f81b461a75514a08103cca7 100644 --- a/pkg/omf/cli/omf.install.fish +++ b/pkg/omf/cli/omf.install.fish @@ -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 diff --git a/pkg/omf/util/omf.package_name.fish b/pkg/omf/util/omf.package_name.fish new file mode 100644 index 0000000000000000000000000000000000000000..77f730c2c0924be5d5e63b6d73b65f7fef323ac7 --- /dev/null +++ b/pkg/omf/util/omf.package_name.fish @@ -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