Run dotvenv
in an empty folder to create a virtual env from scratch and activate it immediately:
$ dotvenv
Created virtual env
Activated virtual env
(.venv) $
Run again to deactivate the virtual env:
(.venv) $ dotvenv
Deactivated virtual env
$
Run for a third time to activate again the virtual env, and so on:
$ dotvenv
Activated virtual env
(.venv) $
If you provide an argument, the virtual environment will be created with a custom prompt:
$ dotvenv my-project
Created virtual env with 'my-project' prompt
Activated virtual env
(my-project) $
Run again to deactivate the virtual env:
(my-project) $ dotvenv
Deactivated virtual env
$
Running another time will reactivate the virtual env, remembering the custom prompt:
$ dotvenv
Activated virtual env
(my-project) $
The function will return the following status codes upon encountering an error:
- code 10 > there was a problem with the existing .venv folder
- code 20 > there was a problem creating the .venv folder
- code 30 > the created virtual env could not be activated