summaryrefslogtreecommitdiff
path: root/src/virtualenv/run/plugin/creators.py
diff options
context:
space:
mode:
authorBernát Gábor <bgabor8@bloomberg.net>2020-02-04 14:51:00 +0000
committerGitHub <noreply@github.com>2020-02-04 14:51:00 +0000
commit7a5d03fe15f1d467f7b224c528b95eccc080b2c1 (patch)
tree7d1ccccac7eb588221fd3aa26c9d9227293ba179 /src/virtualenv/run/plugin/creators.py
parent786c3d0addb5d6b155dc73f8bd444bde00877045 (diff)
downloadvirtualenv-7a5d03fe15f1d467f7b224c528b95eccc080b2c1.tar.gz
rewrite the documentation (#1519)
Diffstat (limited to 'src/virtualenv/run/plugin/creators.py')
-rw-r--r--src/virtualenv/run/plugin/creators.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/virtualenv/run/plugin/creators.py b/src/virtualenv/run/plugin/creators.py
index 946b87a..7c8132d 100644
--- a/src/virtualenv/run/plugin/creators.py
+++ b/src/virtualenv/run/plugin/creators.py
@@ -40,17 +40,23 @@ class CreatorSelector(ComponentBuilder):
def add_selector_arg_parse(self, name, choices):
# prefer the built-in venv if present, otherwise fallback to first defined type
choices = sorted(choices, key=lambda a: 0 if a == "builtin" else 1)
+ default_value = self._get_default(choices)
self.parser.add_argument(
"--{}".format(name),
choices=choices,
- default=next(iter(choices)),
+ default=default_value,
required=False,
help="create environment via{}".format(
"" if self.builtin_key is None else " (builtin = {})".format(self.builtin_key)
),
)
+ @staticmethod
+ def _get_default(choices):
+ return next(iter(choices))
+
def populate_selected_argparse(self, selected):
+ self.parser.description = "options for {} {}".format(self.name, selected)
self._impl_class.add_parser_arguments(self.parser, self.interpreter, self.key_to_meta[selected])
def create(self, options):