dots2/.antidote/functions/__antidote_bundle_name

17 lines
558 B
Bash

#!/bin/zsh
### Get the short name of the bundle.
#function __antidote_bundle_name {
emulate -L zsh; setopt local_options $_adote_funcopts
local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global'
local bundle=$1
local bundle_type="$(__antidote_bundle_type $bundle)"
if [[ "$bundle_type" == (url|sshurl) ]] ; then
bundle=${bundle%.git}
bundle=${bundle:gs/\:/\/}
local parts=(${(ps./.)bundle})
print ${parts[-2]}/${parts[-1]}
else
print $bundle | sed -e "s|^\~/|$HOME/|" -e "s|^$HOME|\$HOME|"
fi
#}