Drop `basename` in favor of Bash strings
Convert `var=$(basename $file)` to `var="${file##*/}"`
pull/1926/head
parent
dee55a03cc
commit
470341b23a
|
|
@ -340,7 +340,7 @@ _bash-it-migrate() {
|
||||||
do
|
do
|
||||||
for f in `sort <(compgen -G "${BASH_IT}/$file_type/enabled/*.bash")`
|
for f in `sort <(compgen -G "${BASH_IT}/$file_type/enabled/*.bash")`
|
||||||
do
|
do
|
||||||
typeset ff=$(basename $f)
|
typeset ff="${f##*/}"
|
||||||
|
|
||||||
# Get the type of component from the extension
|
# Get the type of component from the extension
|
||||||
typeset single_type=$(echo $ff | sed -e 's/.*\.\(.*\)\.bash/\1/g' | sed 's/aliases/alias/g')
|
typeset single_type=$(echo $ff | sed -e 's/.*\.\(.*\)\.bash/\1/g' | sed 's/aliases/alias/g')
|
||||||
|
|
@ -501,7 +501,7 @@ _bash-it-describe ()
|
||||||
do
|
do
|
||||||
# Check for both the old format without the load priority, and the extended format with the priority
|
# Check for both the old format without the load priority, and the extended format with the priority
|
||||||
declare enabled_files enabled_file
|
declare enabled_files enabled_file
|
||||||
enabled_file=$(basename $f)
|
enabled_file="${f##*/}"
|
||||||
enabled_files=$(sort <(compgen -G "${BASH_IT}/enabled/*$BASH_IT_LOAD_PRIORITY_SEPARATOR${enabled_file}") <(compgen -G "${BASH_IT}/$subdirectory/enabled/${enabled_file}") <(compgen -G "${BASH_IT}/$subdirectory/enabled/*$BASH_IT_LOAD_PRIORITY_SEPARATOR${enabled_file}") | wc -l)
|
enabled_files=$(sort <(compgen -G "${BASH_IT}/enabled/*$BASH_IT_LOAD_PRIORITY_SEPARATOR${enabled_file}") <(compgen -G "${BASH_IT}/$subdirectory/enabled/${enabled_file}") <(compgen -G "${BASH_IT}/$subdirectory/enabled/*$BASH_IT_LOAD_PRIORITY_SEPARATOR${enabled_file}") | wc -l)
|
||||||
|
|
||||||
if [ $enabled_files -gt 0 ]; then
|
if [ $enabled_files -gt 0 ]; then
|
||||||
|
|
@ -603,9 +603,9 @@ _disable-thing ()
|
||||||
printf '%s\n' "sorry, $file_entity does not appear to be an enabled $file_type."
|
printf '%s\n' "sorry, $file_entity does not appear to be an enabled $file_type."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
rm "${BASH_IT}/$subdirectory/enabled/$(basename $plugin)"
|
rm "${BASH_IT}/$subdirectory/enabled/${plugin##*/}"
|
||||||
else
|
else
|
||||||
rm "${BASH_IT}/enabled/$(basename $plugin_global)"
|
rm "${BASH_IT}/enabled/${plugin_global##*/}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -681,7 +681,7 @@ _enable-thing ()
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
to_enable=$(basename $to_enable)
|
to_enable="${to_enable##*/}"
|
||||||
# Check for existence of the file using a wildcard, since we don't know which priority might have been used when enabling it.
|
# Check for existence of the file using a wildcard, since we don't know which priority might have been used when enabling it.
|
||||||
typeset enabled_plugin=$(command ls "${BASH_IT}/$subdirectory/enabled/"{[0-9][0-9][0-9]$BASH_IT_LOAD_PRIORITY_SEPARATOR$to_enable,$to_enable} 2>/dev/null | head -1)
|
typeset enabled_plugin=$(command ls "${BASH_IT}/$subdirectory/enabled/"{[0-9][0-9][0-9]$BASH_IT_LOAD_PRIORITY_SEPARATOR$to_enable,$to_enable} 2>/dev/null | head -1)
|
||||||
if [ ! -z "$enabled_plugin" ] ; then
|
if [ ! -z "$enabled_plugin" ] ; then
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ editpost() {
|
||||||
|
|
||||||
for site in ${SITES[@]}
|
for site in ${SITES[@]}
|
||||||
do
|
do
|
||||||
if [ "$(basename $site)" = "$1" ]
|
if [ "${site##*/}" = "$1" ]
|
||||||
then
|
then
|
||||||
SITE=$site
|
SITE=$site
|
||||||
break
|
break
|
||||||
|
|
@ -77,7 +77,7 @@ newpost() {
|
||||||
|
|
||||||
for site in ${SITES[@]}
|
for site in ${SITES[@]}
|
||||||
do
|
do
|
||||||
if [ "$(basename $site)" = "$1" ]
|
if [ "${site##*/}" = "$1" ]
|
||||||
then
|
then
|
||||||
SITE=$site
|
SITE=$site
|
||||||
JEKYLL_FORMATTING=${MARKUPS[$loc]}
|
JEKYLL_FORMATTING=${MARKUPS[$loc]}
|
||||||
|
|
@ -280,7 +280,7 @@ function testsite() {
|
||||||
|
|
||||||
for site in ${SITES[@]}
|
for site in ${SITES[@]}
|
||||||
do
|
do
|
||||||
if [ "$(basename $site)" = "$1" ]
|
if [ "${site##*/}" = "$1" ]
|
||||||
then
|
then
|
||||||
SITE=$site
|
SITE=$site
|
||||||
break
|
break
|
||||||
|
|
@ -312,7 +312,7 @@ function buildsite() {
|
||||||
|
|
||||||
for site in ${SITES[@]}
|
for site in ${SITES[@]}
|
||||||
do
|
do
|
||||||
if [ "$(basename $site)" = "$1" ]
|
if [ "${site##*/}" = "$1" ]
|
||||||
then
|
then
|
||||||
SITE=$site
|
SITE=$site
|
||||||
break
|
break
|
||||||
|
|
@ -347,7 +347,7 @@ function deploysite() {
|
||||||
|
|
||||||
for site in ${SITES[@]}
|
for site in ${SITES[@]}
|
||||||
do
|
do
|
||||||
if [ "$(basename $site)" = "$1" ]
|
if [ "${site##*/}" = "$1" ]
|
||||||
then
|
then
|
||||||
SITE=$site
|
SITE=$site
|
||||||
REMOTE=${REMOTES[$loc]}
|
REMOTE=${REMOTES[$loc]}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ function time-machine-list-machines() {
|
||||||
local tmdest="$(time-machine-destination)/Backups.backupdb"
|
local tmdest="$(time-machine-destination)/Backups.backupdb"
|
||||||
|
|
||||||
find "$tmdest" -maxdepth 1 -mindepth 1 -type d | grep -v "/\." | while read line ; do
|
find "$tmdest" -maxdepth 1 -mindepth 1 -type d | grep -v "/\." | while read line ; do
|
||||||
echo "$(basename "$line")"
|
echo "${line##*/}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ function mkvenv {
|
||||||
about 'create a new virtualenv for this directory'
|
about 'create a new virtualenv for this directory'
|
||||||
group 'virtualenv'
|
group 'virtualenv'
|
||||||
|
|
||||||
cwd=`basename \`pwd\``
|
local cwd="${PWD##*/}"
|
||||||
mkvirtualenv --distribute $cwd
|
mkvirtualenv --distribute "$cwd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -23,19 +23,21 @@ function mkvbranch {
|
||||||
about 'create a new virtualenv for the current branch'
|
about 'create a new virtualenv for the current branch'
|
||||||
group 'virtualenv'
|
group 'virtualenv'
|
||||||
|
|
||||||
mkvirtualenv --distribute "$(basename `pwd`)@$SCM_BRANCH"
|
local cwd="${PWD##*/}"
|
||||||
|
mkvirtualenv --distribute "${cwd}@${SCM_BRANCH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function wovbranch {
|
function wovbranch {
|
||||||
about 'sets workon branch'
|
about 'sets workon branch'
|
||||||
group 'virtualenv'
|
group 'virtualenv'
|
||||||
|
|
||||||
workon "$(basename `pwd`)@$SCM_BRANCH"
|
local cwd="${PWD##*/}"
|
||||||
|
workon "${cwd}@${SCM_BRANCH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function wovenv {
|
function wovenv {
|
||||||
about 'works on the virtualenv for this directory'
|
about 'works on the virtualenv for this directory'
|
||||||
group 'virtualenv'
|
group 'virtualenv'
|
||||||
|
|
||||||
workon "$(basename `pwd`)"
|
workon "${PWD##*/}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue