Skip to content
Myr

Apply the same splitting logic for explicit envvars

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 817ef38 · Browse files · 2 files+15 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+15 added−6 removed

  • tests:+9 added−0 removed
  • other:+6 added−6 removed

2 files+15 added−6 removed

modified:click/core.py+6 added-6 removed
1078 unmodified lines
1079 value_proc=lambda x: self.process_value(ctx, x))10801081 def value_from_envvar(self, ctx):1082 rv = Parameter.value_from_envvar(self, ctx)1083 if rv is not None:1084 return rv1085 if self.allow_from_autoenv and ctx.auto_envvar_prefix is not None:1083 if rv is None and \1084 self.allow_from_autoenv and \1085 ctx.auto_envvar_prefix is not None:1086 envvar = '%s_%s' % (ctx.auto_envvar_prefix, self.name.upper())1087 rv = os.environ.get(envvar)1088 if self.multiple:1089 rv = self.type.split_envvar_value(rv)1090 return rv1088 if rv is not None and self.multiple:1089 rv = self.type.split_envvar_value(rv)1090 return rv10911092 def full_process_value(self, ctx, value):1093 if value is None and self.prompt is not None:1094 return self.prompt_for_value(ctx)
48 unmodified lines
modified:tests/test_options.py+9 added
66 unmodified lines
67 assert not result.exception68 assert result.output == 'foo|bar|baz\n'6970 @click.command()71 @click.option('--arg', multiple=True, envvar='X')72 def cmd(arg):73 click.echo('|'.join(arg))7475 result = runner.invoke(cmd, [], env={'X': 'foo bar baz'})76 assert not result.exception77 assert result.output == 'foo|bar|baz\n'7879 @click.command()80 @click.option('--arg', multiple=True, type=click.Path())81 def cmd(arg):82 click.echo('|'.join(arg))83
4 unmodified lines