#!/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
    # Replace ~ and $HOME with \$HOME
    bundle=${bundle/#\~\//\$HOME/}
    bundle=${bundle/#$HOME/\$HOME}
    print -r -- "$bundle"
  fi
#}
