refactor argparse handling

This commit is contained in:
gcarq
2017-11-17 17:18:31 +01:00
parent 5be7be6189
commit b682262486
2 changed files with 19 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
import copy
import json
import logging
import sys
import time
import traceback
from datetime import datetime
@@ -14,8 +15,9 @@ from jsonschema import validate
from freqtrade import __version__, exchange, persistence
from freqtrade.analyze import get_signal, SignalType
from freqtrade.misc import CONF_SCHEMA, State, get_state, update_state, parse_args, throttle
from freqtrade.misc import (
CONF_SCHEMA, State, get_state, update_state, build_arg_parser, throttle, FreqtradeException
FreqtradeException
)
from freqtrade.persistence import Trade
from freqtrade.rpc import telegram
@@ -316,11 +318,8 @@ def main():
:return: None
"""
global _CONF
args = build_arg_parser().parse_args()
# Check if subcommand has been selected
if hasattr(args, 'func'):
args.func(args)
args = parse_args(sys.argv[1:])
if not args:
exit(0)
# Initialize logger