mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-02-20 21:17:27 +01:00
Make mkv & vrun use PYTHON_VENV_NAME too
This commit is contained in:
parent
12163f32e9
commit
81f16ed03d
2 changed files with 9 additions and 6 deletions
|
@ -26,9 +26,11 @@ The plugin provides three utilities to manage Python 3.3+
|
|||
[venv](https://docs.python.org/3/library/venv.html) virtual
|
||||
environments:
|
||||
|
||||
- `mkv [name]`: make a new virtual environment called `name` (default: `venv`) in current directory.
|
||||
- `mkv [name]`: Make a new virtual environment called *name* (else
|
||||
`$PYTHON_VENV_NAME`, else "venv") in the current directory.
|
||||
|
||||
- `vrun [name]`: activate virtual environment called `name` (default: `venv`) in current directory.
|
||||
- `vrun [name]`: Activate the virtual environment called *name* (else
|
||||
`$PYTHON_VENV_NAME`, else "venv") in the current directory.
|
||||
|
||||
- `auto_vrun`: Automatically activate the venv virtual environment when
|
||||
cd’ing into a directory containing `venv/bin/activate`, and
|
||||
|
|
|
@ -53,9 +53,9 @@ alias pyserver="python3 -m http.server"
|
|||
## venv utilities
|
||||
|
||||
# Activate a the python virtual environment specified.
|
||||
# If none specified, use 'venv'.
|
||||
# If none specified, use $PYTHON_VENV_NAME, else 'venv'.
|
||||
function vrun() {
|
||||
local name="${1:-venv}"
|
||||
local name="${1:-${PYTHON_VENV_NAME:-venv}}"
|
||||
local venvpath="${name:P}"
|
||||
|
||||
if [[ ! -d "$venvpath" ]]; then
|
||||
|
@ -72,9 +72,10 @@ function vrun() {
|
|||
echo "Activated virtual environment ${name}"
|
||||
}
|
||||
|
||||
# Create a new virtual environment, with default name 'venv'.
|
||||
# Create a new virtual environment using the specified name.
|
||||
# If none specfied, use $PYTHON_VENV_NAME, else 'venv'.
|
||||
function mkv() {
|
||||
local name="${1:-venv}"
|
||||
local name="${1:-${PYTHON_VENV_NAME:-venv}}"
|
||||
local venvpath="${name:P}"
|
||||
|
||||
python3 -m venv "${name}" || return
|
||||
|
|
Loading…
Add table
Reference in a new issue