Skip to content

Commit

Permalink
Fix use_global_config and use_env_var for options with unspecified de…
Browse files Browse the repository at this point in the history
…faults.

Setting up default_conda_prefix in ~/.planemo.yml was not being respected.
  • Loading branch information
jmchilton committed Jun 16, 2017
1 parent 9636682 commit 475104c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion planemo/config.py
Expand Up @@ -74,8 +74,12 @@ def planemo_option(*args, **kwargs):
use_global_config = kwargs.pop("use_global_config", False)
use_env_var = kwargs.pop("use_env_var", False)

if "default" in kwargs:
default_specified = "default" in kwargs
default = None
if default_specified:
default = kwargs.pop("default")

if default_specified or use_global_config or use_env_var:
outer_callback = kwargs.pop("callback", None)

def callback(ctx, param, value):
Expand All @@ -92,6 +96,8 @@ def callback(ctx, param, value):
return result

kwargs["callback"] = callback

if default_specified:
kwargs["default"] = None

if use_env_var:
Expand Down

0 comments on commit 475104c

Please sign in to comment.