mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Detect shell
This commit is contained in:
parent
4971d9e35e
commit
c1674cd552
1 changed files with 22 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# Summary: Configure the shell environment for pyenv
|
||||
# Usage: eval "$(pyenv init [-|--path] [--no-push-path] [--no-rehash] [<shell>])"
|
||||
# Usage: eval "$(pyenv init [-|--path] [--no-push-path] [--detect-shell] [--no-rehash] [<shell>])"
|
||||
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
|
@ -11,6 +11,7 @@ if [ "$1" = "--complete" ]; then
|
|||
echo --path
|
||||
echo --no-push-path
|
||||
echo --no-rehash
|
||||
echo --detect-shell
|
||||
echo bash
|
||||
echo fish
|
||||
echo ksh
|
||||
|
@ -33,6 +34,11 @@ do
|
|||
shift
|
||||
fi
|
||||
|
||||
if [ "$args" = "--detect-shell" ]; then
|
||||
mode="detect-shell"
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ "$args" = "--no-push-path" ]; then
|
||||
no_push_path=1
|
||||
shift
|
||||
|
@ -76,12 +82,17 @@ function main() {
|
|||
print_shell_function
|
||||
exit 0
|
||||
;;
|
||||
"detect-shell")
|
||||
detect_profile
|
||||
print_detect_shell
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
# should never get here
|
||||
exit 2
|
||||
}
|
||||
|
||||
function help_() {
|
||||
function detect_profile() {
|
||||
case "$shell" in
|
||||
bash )
|
||||
if [ -e '~/.bash_profile' ]; then
|
||||
|
@ -105,7 +116,16 @@ function help_() {
|
|||
rc='your shell'\''s interactive startup file'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function print_detect_shell() {
|
||||
echo "PYENV_SHELL_DETECT=$shell"
|
||||
echo "PYENV_PROFILE_DETECT=$profile"
|
||||
echo "PYENV_RC_DETECT=$rc"
|
||||
}
|
||||
|
||||
function help_() {
|
||||
detect_profile
|
||||
{
|
||||
case "$shell" in
|
||||
fish )
|
||||
|
|
Loading…
Reference in a new issue