mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Split client arguments to accept kwarguments
This commit is contained in:
parent
9d3e435162
commit
a03528406f
|
@ -102,7 +102,18 @@ def main_exec(parsed: Dict[str, Any]):
|
||||||
print_commands()
|
print_commands()
|
||||||
return
|
return
|
||||||
|
|
||||||
print(json.dumps(getattr(client, command)(*parsed["command_arguments"])))
|
# Split arguments with = into key/value pairs
|
||||||
|
kwargs = {x.split("=")[0]: x.split("=")[1] for x in parsed["command_arguments"] if "=" in x}
|
||||||
|
args = [x for x in parsed["command_arguments"] if "=" not in x]
|
||||||
|
try:
|
||||||
|
res = getattr(client, command)(*args, **kwargs)
|
||||||
|
print(json.dumps(res))
|
||||||
|
except TypeError as e:
|
||||||
|
logger.error(f"Error executing command {command}: {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fatal Error executing command {command}: {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user