Add Custom message during transition period

This commit is contained in:
Matthias 2019-09-16 06:35:37 +02:00
parent 0aa73d5b35
commit 9ef874e979
2 changed files with 16 additions and 5 deletions

View File

@ -74,8 +74,9 @@ class Arguments:
# Workaround issue in argparse with action='append' and default value
# (see https://bugs.python.org/issue16399)
# Allow no-config for certain commands (like downloading / plotting)
if (parsed_arg.config is None and ((Path.cwd() / constants.DEFAULT_CONFIG).is_file() or
not ('command' in parsed_arg and parsed_arg.command in NO_CONF_REQURIED))):
if ('config' in parsed_arg and parsed_arg.config is None and
((Path.cwd() / constants.DEFAULT_CONFIG).is_file() or
not ('command' in parsed_arg and parsed_arg.command in NO_CONF_REQURIED))):
parsed_arg.config = [constants.DEFAULT_CONFIG]
return parsed_arg
@ -97,15 +98,18 @@ class Arguments:
self._build_args(optionlist=ARGS_COMMON, parser=group)
# Build main command
self.parser = argparse.ArgumentParser(description='Free, open source crypto trading bot',
parents=[_common_parser])
self.parser = argparse.ArgumentParser(description='Free, open source crypto trading bot')
from freqtrade.optimize import start_backtesting, start_hyperopt, start_edge
from freqtrade.utils import (start_create_userdir, start_download_data,
start_list_exchanges, start_trading)
from freqtrade.plot.plot_utils import start_plot_dataframe, start_plot_profit
subparsers = self.parser.add_subparsers(dest='command', required=True)
subparsers = self.parser.add_subparsers(dest='command',
# Use custom message when no subhandler is added
# shown from `main.py`
# required=True
)
# Add trade subcommand
trade_cmd = subparsers.add_parser('trade', help='Trade module.',

View File

@ -35,6 +35,13 @@ def main(sysargv: List[str] = None) -> None:
# Call subcommand.
if 'func' in args:
return_code = args['func'](args)
else:
# No subcommand was issued.
raise OperationalException(
"Usage of freqtrade requires a subcommand.\n"
"To use the previous behaviour, run freqtrade with `freqtrade trade [...]`.\n"
"To see a full list of options, please use `freqtrade --help`"
)
except SystemExit as e:
return_code = e