Use subparser-name to exclude from config requires

This commit is contained in:
Matthias 2019-08-31 15:15:10 +02:00
parent f278fcfc3f
commit 1760a8dfbc

View File

@ -40,7 +40,7 @@ ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit", "db_
ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url", ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url",
"trade_source", "ticker_interval"] "trade_source", "ticker_interval"]
NO_CONF_REQURIED = ["start_download_data"] NO_CONF_REQURIED = ["download-data", "plot-dataframe", "plot-profit"]
class Arguments(object): class Arguments(object):
@ -79,8 +79,7 @@ class Arguments(object):
# (see https://bugs.python.org/issue16399) # (see https://bugs.python.org/issue16399)
# Allow no-config for certain commands (like downloading / plotting) # Allow no-config for certain commands (like downloading / plotting)
if (not self._no_default_config and parsed_arg.config is None if (not self._no_default_config and parsed_arg.config is None
and not (hasattr(parsed_arg, 'func') and not ('subparser' in parsed_arg and parsed_arg.subparser in NO_CONF_REQURIED)):
and parsed_arg.func.__name__ in NO_CONF_REQURIED)):
parsed_arg.config = [constants.DEFAULT_CONFIG] parsed_arg.config = [constants.DEFAULT_CONFIG]
return parsed_arg return parsed_arg