File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed
Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -489,7 +489,10 @@ PROJECT_HOME.
489489
490490Syntax::
491491
492- mkproject [-t template] [virtualenv_options] ENVNAME
492+ mkproject [-f|--force] [-t template] [virtualenv_options] ENVNAME
493+
494+ -f, --force Create the virtualenv even if the project directory
495+ already exists
493496
494497The template option may be repeated to have several templates used to
495498create a new project. The templates are applied in the order named on
Original file line number Diff line number Diff line change 2424
2525- Sphinx
2626- docutils
27+ - sphinxcontrib-bitbucket
2728
2829Once all of the tools are installed into a virtualenv using
2930pip, run ``make html `` to generate the HTML version of the
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ test_project_exists () {
6666 mkproject myproject4 > /dev/null 2>&1
6767 output=` mkproject myproject4 2>&1 `
6868 assertTrue " Did not see expected message 'already exists' in: $output " " echo $output | grep 'already exists'"
69+ output=` mkproject -f myproject4 2>&1 `
70+ assertFalse " Saw unexpected message 'already exists' in: $output " " echo $output | grep 'already exists'"
6971}
7072
7173test_same_workon_and_project_home () {
Original file line number Diff line number Diff line change @@ -974,14 +974,17 @@ function setvirtualenvproject {
974974
975975# Show help for mkproject
976976function virtualenvwrapper_mkproject_help {
977- echo " Usage: mkproject [-t template] [virtualenv options] project_name"
978- echo " "
977+ echo " Usage: mkproject [-f|--force] [-t template] [virtualenv options] project_name"
978+ echo
979+ echo " -f, --force Create the virtualenv even if the project directory"
980+ echo " already exists"
981+ echo
979982 echo " Multiple templates may be selected. They are applied in the order"
980983 echo " specified on the command line."
981- echo ;
984+ echo
982985 echo " mkvirtualenv help:"
983986 echo
984- mkvirtualenv -h;
987+ mkvirtualenv -h
985988 echo
986989 echo " Available project templates:"
987990 echo
@@ -996,9 +999,11 @@ function mkproject {
996999 typeset tst
9971000 typeset a
9981001 typeset t
1002+ typeset force
9991003 typeset templates
10001004
10011005 in_args=( " $@ " )
1006+ force=0
10021007
10031008 if [ -n " $ZSH_VERSION " ]
10041009 then
@@ -1015,6 +1020,8 @@ function mkproject {
10151020 -h|--help)
10161021 virtualenvwrapper_mkproject_help;
10171022 return ;;
1023+ -f|--force)
1024+ force=1;;
10181025 -t)
10191026 i=$(( $i + 1 )) ;
10201027 templates=" $templates ${in_args[$i]} " ;;
@@ -1038,7 +1045,7 @@ function mkproject {
10381045 eval " typeset envname=\$ $# "
10391046 virtualenvwrapper_verify_project_home || return 1
10401047
1041- if [ -d " $PROJECT_HOME /$envname " ]
1048+ if [ -d " $PROJECT_HOME /$envname " -a $force -eq 0 ]
10421049 then
10431050 echo " Project $envname already exists." >&2
10441051 return 1
You can’t perform that action at this time.
0 commit comments