Debian Codegraph @

libexec/pyenv-whence

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # Summary: List all Python versions that contain the given executable
3 # Usage: pyenv whence [--path] <command>
4
5 set -e
6 [scip-shell system . . `[`. -n "$PYENV_DEBUG" ] && set -x
7
8 # Provide pyenv completions
9 if [scip-shell system . . `[`. "$1" = "--complete" ]; then
10 echoscip-shell system . . echo. --path
11 exec pyenv-shims --short
12 fi
13
14 if [scip-shell system . . `[`. "$1" = "--path" ]; then
15 print_paths="1"
16 shift
17 else
18 print_paths=""
19 fi
20
21 whencescip-shell shell shell-project 0.0.0 whence().() {
22 local command="$1"
23 pyenv-versions --bare | while read -r version; do
24 path="$(pyenv-prefix "$version")/bin/${command}"
25 if [scip-shell system . . `[`. -x "$path" ]; then
26 [scip-shell system . . `[`. "$print_paths" ] && echoscip-shell system . . echo. "$path" || echoscip-shell system . . echo. "$version"
27 fi
28 done
29 }
30
31 PYENV_COMMAND="$1"
32 if [scip-shell system . . `[`. -z "$PYENV_COMMAND" ]; then
33 pyenv-help --usage whence >&2
34 exit 1
35 fi
36
37 result="$(whencescip-shell shell shell-project 0.0.0 whence(). "$PYENV_COMMAND")"
38 [scip-shell system . . `[`. -n "$result" ] && echoscip-shell system . . echo. "$result"