Skip to content

Commit 2187fa6

Browse files
committed
Add help option to workon
Fixes issue #169
1 parent e3b7ba5 commit 2187fa6

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

docs/source/history.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ dev
66

77
- Improve tab-completion support for users of the lazy-loading
88
mode. (:bbuser:`upsuper`)
9+
- Add ``--help`` option to ``mkproject``.
10+
- Add ``--help`` option to ``workon``.
911

1012
3.6.1
1113

virtualenvwrapper.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,11 +619,51 @@ function showvirtualenv {
619619
echo
620620
}
621621

622+
# Show help for workon
623+
function workon_help {
624+
echo "Usage: workon env_name"
625+
echo ""
626+
echo " Deactivate any currently activated virtualenv"
627+
echo " and activate the named environment, triggering"
628+
echo " any hooks in the process."
629+
echo ""
630+
echo " workon"
631+
echo ""
632+
echo " Print a list of available environments."
633+
echo " (See also lsvirtualenv -b)"
634+
echo ""
635+
echo " workon (-h|--help)"
636+
echo ""
637+
echo " Show this help message."
638+
echo ""
639+
}
640+
622641
# List or change working virtual environments
623642
#
624643
# Usage: workon [environment_name]
625644
#
626645
function workon {
646+
in_args=( "$@" )
647+
648+
if [ -n "$ZSH_VERSION" ]
649+
then
650+
i=1
651+
tst="-le"
652+
else
653+
i=0
654+
tst="-lt"
655+
fi
656+
while [ $i $tst $# ]
657+
do
658+
a="${in_args[$i]}"
659+
case "$a" in
660+
-h|--help)
661+
workon_help;
662+
return 0;;
663+
esac
664+
i=$(( $i + 1 ))
665+
done
666+
627667
typeset env_name="$1"
628668
if [ "$env_name" = "" ]
629669
then

0 commit comments

Comments
 (0)