Improve code clarity

This commit is contained in:
Gerard Vermeulen 2022-09-18 12:37:36 +02:00
parent 7c16bf3ba5
commit 1171bc825a

View File

@ -3800,14 +3800,16 @@ and listing [[lst:setting-python-shell-virtualenv-root]] to set
"Return \"pyenv root\" as a directory."
(cl-destructuring-bind (exit-code output)
(shell-command-with-exit-code "pyenv" "root")
(if (= 0 exit-code) (file-name-as-directory (string-trim output))
(if (= 0 exit-code)
(file-name-as-directory (string-trim output))
(error "%s" (string-trim output)))))
(defun pyenv-version-name ()
"Return \"pyenv version-name\"."
(cl-destructuring-bind (exit-code output)
(shell-command-with-exit-code "pyenv" "version-name")
(if (= 0 exit-code) (string-trim output)
(if (= 0 exit-code)
(string-trim output)
(error "%s" (string-trim output)))))
(defun pyenv-versions ()
@ -3816,7 +3818,8 @@ and listing [[lst:setting-python-shell-virtualenv-root]] to set
(cl-destructuring-bind (exit-code output)
(shell-command-with-exit-code
"pyenv" "versions" "--bare" "--skip-aliases")
(if (= 0 exit-code) (cons "system" (split-string output))
(if (= 0 exit-code)
(cons "system" (split-string output))
(error "%s" (string-trim output)))))
(defun pyenv-virtualenvs ()
@ -3824,7 +3827,8 @@ and listing [[lst:setting-python-shell-virtualenv-root]] to set
(cl-destructuring-bind (exit-code output)
(shell-command-with-exit-code
"pyenv" "virtualenvs" "--bare" "--skip-aliases")
(if (= 0 exit-code) (split-string output)
(if (= 0 exit-code)
(split-string output)
(error "%s" (string-trim output))))))
#+end_src