Skip to content

Commit d7e9787

Browse files
committed
Clean up help functions. Add documentation for new -r option to mkvirtualenv.
1 parent 0530f67 commit d7e9787

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

docs/en/command_ref.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ Create a new environment, in the WORKON_HOME.
2222

2323
Syntax::
2424

25-
mkvirtualenv [options] ENVNAME
25+
mkvirtualenv [-r requirements_file] [virtualenv options] ENVNAME
2626

27-
All command line options are passed directly to ``virtualenv``. The
28-
new environment is automatically activated after being initialized.
27+
All command line options except ``-r`` and ``-h`` are passed directly
28+
to ``virtualenv``. The new environment is automatically activated
29+
after being initialized.
2930

3031
::
3132

@@ -40,10 +41,17 @@ new environment is automatically activated after being initialized.
4041
mynewenv
4142
(mynewenv)$
4243

44+
The ``-r`` option can be used to specify a text file listing packages
45+
to be installed. The argument value is passed to ``pip -r`` to be
46+
installed.
47+
4348
.. seealso::
4449

4550
* :ref:`scripts-premkvirtualenv`
4651
* :ref:`scripts-postmkvirtualenv`
52+
* `requirements file format`_
53+
54+
.. _requirements file format: http://www.pip-installer.org/en/latest/requirement-format.html
4755

4856
.. _command-lsvirtualenv:
4957

docs/en/history.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ dev
1010
``virtualenvwrapper.project`` plugin into the main project, adding
1111
:ref:`command-mkproject`, :ref:`command-cdproject`, and
1212
:ref:`command-setvirtualenvproject` commands.
13+
- Add ``-r`` option to :ref:`command-mkvirtualenv` to install
14+
dependencies using a pip requirements file.
1315

1416
2.8
1517

virtualenvwrapper.sh

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ function mkvirtualenv_help {
277277
echo
278278
echo " Provide a pip requirements file to install a base set of packages"
279279
echo " into the new environment."
280+
echo;
281+
echo 'virtualenv help:';
282+
echo;
283+
virtualenv -h;
280284
}
281285

282286
# Create a new environment, in the WORKON_HOME.
@@ -309,13 +313,7 @@ function mkvirtualenv {
309313
# echo "arg $i : $a"
310314
case "$a" in
311315
-h)
312-
echo 'mkvirtualenv help:';
313-
echo;
314316
mkvirtualenv_help;
315-
echo;
316-
echo 'virtualenv help:';
317-
echo;
318-
virtualenv -h;
319317
return;;
320318
-r)
321319
i=$(( $i + 1 ));
@@ -761,8 +759,12 @@ function mkproject_help {
761759
echo ""
762760
echo "Multiple templates may be selected. They are applied in the order"
763761
echo "specified on the command line."
762+
echo;
763+
echo "mkvirtualenv help:"
764764
echo
765-
echo "Available templates:"
765+
mkvirtualenv -h;
766+
echo
767+
echo "Available project templates:"
766768
echo
767769
"$VIRTUALENVWRAPPER_PYTHON" -m virtualenvwrapper.hook_loader -l project.template
768770
}
@@ -793,13 +795,7 @@ function mkproject {
793795
# echo "arg $i : $a"
794796
case "$a" in
795797
-h)
796-
echo 'mkproject help:';
797-
echo;
798798
mkproject_help;
799-
echo;
800-
echo 'mkvirtualenv help:';
801-
echo;
802-
mkvirtualenv -h;
803799
return;;
804800
-t)
805801
i=$(( $i + 1 ));

0 commit comments

Comments
 (0)