Rename `POWERLINE_CONFIG` to `POWERLINE_CONFIG_COMMAND` where appropriate

Ref #1124
This commit is contained in:
ZyX 2015-01-06 16:16:39 +03:00
parent 983315b2c5
commit b17d03e688
6 changed files with 37 additions and 37 deletions

View File

@ -121,9 +121,9 @@ Prompt command
In addition to the above configuration options you can use In addition to the above configuration options you can use
``$POWERLINE_COMMAND`` environment variable to tell shell or tmux to use ``$POWERLINE_COMMAND`` environment variable to tell shell or tmux to use
specific powerline implementation and ``$POWERLINE_CONFIG`` to tell zsh or tmux specific powerline implementation and ``$POWERLINE_CONFIG_COMMAND`` to tell zsh
where ``powerline-config`` script is located. This is mostly useful for putting or tmux where ``powerline-config`` script is located. This is mostly useful for
powerline into different directory. putting powerline into different directory.
.. note:: .. note::

View File

@ -75,7 +75,7 @@ _powerline_set_prompt() {
_powerline_setup_prompt() { _powerline_setup_prompt() {
VIRTUAL_ENV_DISABLE_PROMPT=1 VIRTUAL_ENV_DISABLE_PROMPT=1
if test -z "${POWERLINE_COMMAND}" ; then if test -z "${POWERLINE_COMMAND}" ; then
POWERLINE_COMMAND="$("$POWERLINE_CONFIG" shell command)" POWERLINE_COMMAND="$("$POWERLINE_CONFIG_COMMAND" shell command)"
fi fi
test "x$PROMPT_COMMAND" != "x${PROMPT_COMMAND%_powerline_set_prompt*}" || test "x$PROMPT_COMMAND" != "x${PROMPT_COMMAND%_powerline_set_prompt*}" ||
PROMPT_COMMAND=$'_powerline_set_prompt\n'"${PROMPT_COMMAND}" PROMPT_COMMAND=$'_powerline_set_prompt\n'"${PROMPT_COMMAND}"
@ -83,17 +83,17 @@ _powerline_setup_prompt() {
PS3="$(_powerline_local_prompt left '' 0 0 select)" PS3="$(_powerline_local_prompt left '' 0 0 select)"
} }
if test -z "${POWERLINE_CONFIG}" ; then if test -z "${POWERLINE_CONFIG_COMMAND}" ; then
if which powerline-config >/dev/null ; then if which powerline-config >/dev/null ; then
POWERLINE_CONFIG=powerline-config POWERLINE_CONFIG_COMMAND=powerline-config
else else
POWERLINE_CONFIG="$(dirname "$BASH_SOURCE")/../../../scripts/powerline-config" POWERLINE_CONFIG_COMMAND="$(dirname "$BASH_SOURCE")/../../../scripts/powerline-config"
fi fi
fi fi
if "${POWERLINE_CONFIG}" shell --shell=bash uses prompt ; then if "${POWERLINE_CONFIG_COMMAND}" shell --shell=bash uses prompt ; then
_powerline_setup_prompt _powerline_setup_prompt
fi fi
if "${POWERLINE_CONFIG}" shell --shell=bash uses tmux ; then if "${POWERLINE_CONFIG_COMMAND}" shell --shell=bash uses tmux ; then
_powerline_init_tmux_support _powerline_init_tmux_support
fi fi

View File

@ -21,17 +21,17 @@ function powerline-setup
end end
end end
if test -z "$POWERLINE_CONFIG" if test -z "$POWERLINE_CONFIG_COMMAND"
if which powerline-config >/dev/null if which powerline-config >/dev/null
set -g POWERLINE_CONFIG powerline-config set -g POWERLINE_CONFIG_COMMAND powerline-config
else else
set -g POWERLINE_CONFIG (dirname (status -f))/../../../scripts/powerline-config set -g POWERLINE_CONFIG_COMMAND (dirname (status -f))/../../../scripts/powerline-config
end end
end end
if eval $POWERLINE_CONFIG shell --shell=fish uses prompt if eval $POWERLINE_CONFIG_COMMAND shell --shell=fish uses prompt
if test -z "$POWERLINE_COMMAND" if test -z "$POWERLINE_COMMAND"
set -g POWERLINE_COMMAND (eval $POWERLINE_CONFIG shell command) set -g POWERLINE_COMMAND (eval $POWERLINE_CONFIG_COMMAND shell command)
end end
function --on-variable fish_bind_mode _powerline_bind_mode function --on-variable fish_bind_mode _powerline_bind_mode
set -g -x _POWERLINE_MODE $fish_bind_mode set -g -x _POWERLINE_MODE $fish_bind_mode
@ -81,7 +81,7 @@ function powerline-setup
_powerline_set_default_mode _powerline_set_default_mode
_powerline_update _powerline_update
end end
if eval $POWERLINE_CONFIG shell --shell=fish uses tmux if eval $POWERLINE_CONFIG_COMMAND shell --shell=fish uses tmux
if test -n "$TMUX" if test -n "$TMUX"
if tmux refresh -S ^/dev/null if tmux refresh -S ^/dev/null
function _powerline_tmux_setenv function _powerline_tmux_setenv

View File

@ -100,7 +100,7 @@ _powerline_set_set_jobs() {
_powerline_set_command() { _powerline_set_command() {
if test -z "${POWERLINE_COMMAND}" ; then if test -z "${POWERLINE_COMMAND}" ; then
POWERLINE_COMMAND="$("$POWERLINE_CONFIG" shell command)" POWERLINE_COMMAND="$("$POWERLINE_CONFIG_COMMAND" shell command)"
fi fi
} }
@ -214,11 +214,11 @@ _powerline_init_tmux_support() {
fi fi
} }
if test -z "${POWERLINE_CONFIG}" ; then if test -z "${POWERLINE_CONFIG_COMMAND}" ; then
if which powerline-config >/dev/null ; then if which powerline-config >/dev/null ; then
POWERLINE_CONFIG=powerline-config POWERLINE_CONFIG_COMMAND=powerline-config
else else
POWERLINE_CONFIG="$(dirname "$_POWERLINE_SOURCED")/../../../scripts/powerline-config" POWERLINE_CONFIG_COMMAND="$(dirname "$_POWERLINE_SOURCED")/../../../scripts/powerline-config"
fi fi
fi fi
@ -227,9 +227,9 @@ _POWERLINE_USED_SHELL=${0#-}
_POWERLINE_USED_SHELL=${_POWERLINE_USED_SHELL#/usr} _POWERLINE_USED_SHELL=${_POWERLINE_USED_SHELL#/usr}
_POWERLINE_USED_SHELL=${_POWERLINE_USED_SHELL#/bin/} _POWERLINE_USED_SHELL=${_POWERLINE_USED_SHELL#/bin/}
if "${POWERLINE_CONFIG}" shell uses tmux ; then if "${POWERLINE_CONFIG_COMMAND}" shell uses tmux ; then
_powerline_init_tmux_support $_POWERLINE_USED_SHELL _powerline_init_tmux_support $_POWERLINE_USED_SHELL
fi fi
if "${POWERLINE_CONFIG}" shell --shell=bash uses prompt ; then if "${POWERLINE_CONFIG_COMMAND}" shell --shell=bash uses prompt ; then
_powerline_setup_prompt $_POWERLINE_USED_SHELL _powerline_setup_prompt $_POWERLINE_USED_SHELL
fi fi

View File

@ -5,31 +5,31 @@
# Guess this relies on `$_` being set as to last argument to previous command # Guess this relies on `$_` being set as to last argument to previous command
# which must be `.` or `source` in this case # which must be `.` or `source` in this case
set POWERLINE_SOURCED=($_) set POWERLINE_SOURCED=($_)
if ! $?POWERLINE_CONFIG then if ! $?POWERLINE_CONFIG_COMMAND then
if ( { which powerline-config > /dev/null } ) then if ( { which powerline-config > /dev/null } ) then
set POWERLINE_CONFIG="powerline-config" set POWERLINE_CONFIG_COMMAND="powerline-config"
else else
set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config" set POWERLINE_CONFIG_COMMAND="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
endif endif
else else
if "$POWERLINE_CONFIG" == "" then if "$POWERLINE_CONFIG_COMMAND" == "" then
if ( { which powerline-config > /dev/null } ) then if ( { which powerline-config > /dev/null } ) then
set POWERLINE_CONFIG="powerline-config" set POWERLINE_CONFIG_COMMAND="powerline-config"
else else
set POWERLINE_CONFIG="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config" set POWERLINE_CONFIG_COMMAND="$POWERLINE_SOURCED[2]:h:h:h:h/scripts/powerline-config"
endif endif
endif endif
endif endif
if ( { $POWERLINE_CONFIG shell --shell=tcsh uses tmux } ) then if ( { $POWERLINE_CONFIG_COMMAND shell --shell=tcsh uses tmux } ) then
alias _powerline_tmux_set_pwd 'if ( $?TMUX && { tmux refresh -S >&/dev/null } ) tmux setenv -g TMUX_PWD_`tmux display -p "#D" | tr -d %` $PWD:q ; if ( $?TMUX ) tmux refresh -S >&/dev/null' alias _powerline_tmux_set_pwd 'if ( $?TMUX && { tmux refresh -S >&/dev/null } ) tmux setenv -g TMUX_PWD_`tmux display -p "#D" | tr -d %` $PWD:q ; if ( $?TMUX ) tmux refresh -S >&/dev/null'
alias cwdcmd "`alias cwdcmd` ; _powerline_tmux_set_pwd" alias cwdcmd "`alias cwdcmd` ; _powerline_tmux_set_pwd"
endif endif
if ( { $POWERLINE_CONFIG shell --shell=tcsh uses prompt } ) then if ( { $POWERLINE_CONFIG_COMMAND shell --shell=tcsh uses prompt } ) then
if ! $?POWERLINE_COMMAND then if ! $?POWERLINE_COMMAND then
set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`" set POWERLINE_COMMAND="`$POWERLINE_CONFIG_COMMAND:q shell command`"
else else
if "$POWERLINE_COMMAND" == "" then if "$POWERLINE_COMMAND" == "" then
set POWERLINE_COMMAND="`$POWERLINE_CONFIG:q shell command`" set POWERLINE_COMMAND="`$POWERLINE_CONFIG_COMMAND:q shell command`"
endif endif
endif endif

View File

@ -136,7 +136,7 @@ _powerline_setup_prompt() {
} }
else else
if test -z "${POWERLINE_COMMAND}" ; then if test -z "${POWERLINE_COMMAND}" ; then
POWERLINE_COMMAND="$($POWERLINE_CONFIG shell command)" POWERLINE_COMMAND="$($POWERLINE_CONFIG_COMMAND shell command)"
fi fi
local add_args='-r .zsh' local add_args='-r .zsh'
@ -183,21 +183,21 @@ _powerline_add_widget() {
fi fi
} }
if test -z "${POWERLINE_CONFIG}" ; then if test -z "${POWERLINE_CONFIG_COMMAND}" ; then
if which powerline-config >/dev/null ; then if which powerline-config >/dev/null ; then
export POWERLINE_CONFIG=powerline-config export POWERLINE_CONFIG_COMMAND=powerline-config
else else
export POWERLINE_CONFIG="$_POWERLINE_SOURCED:h:h:h:h/scripts/powerline-config" export POWERLINE_CONFIG_COMMAND="$_POWERLINE_SOURCED:h:h:h:h/scripts/powerline-config"
fi fi
fi fi
setopt promptpercent setopt promptpercent
setopt promptsubst setopt promptsubst
if ${POWERLINE_CONFIG} shell --shell=zsh uses prompt ; then if "${POWERLINE_CONFIG_COMMAND}" shell --shell=zsh uses prompt ; then
_powerline_setup_prompt _powerline_setup_prompt
_powerline_init_modes_support _powerline_init_modes_support
fi fi
if ${POWERLINE_CONFIG} shell --shell=zsh uses tmux ; then if "${POWERLINE_CONFIG_COMMAND}" shell --shell=zsh uses tmux ; then
_powerline_init_tmux_support _powerline_init_tmux_support
fi fi