From c01863ab13bd947ea0ae1b2db74b3297dc68ef1d Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 2 Aug 2021 19:47:52 +0000 Subject: [PATCH] start-coin-daemons.py: add --quiet option --- mmgen/daemon.py | 8 ++++---- test/start-coin-daemons.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mmgen/daemon.py b/mmgen/daemon.py index 851fed4f..76fb38b0 100755 --- a/mmgen/daemon.py +++ b/mmgen/daemon.py @@ -154,9 +154,9 @@ class Daemon(MMGenObject): f'port {self.bind_port}', w = 52 + len(extra_text) ) - def start(self,silent=False): + def start(self,quiet=False,silent=False): if self.state == 'ready': - if not silent: + if not (quiet or silent): msg(self.state_msg(extra_text='already')) return True @@ -179,14 +179,14 @@ class Daemon(MMGenObject): return ret - def stop(self,silent=False): + def stop(self,quiet=False,silent=False): if self.state == 'ready': ret = self.do_stop(silent=silent) if self.wait: self.wait_for_state('stopped') return ret else: - if not silent: + if not (quiet or silent): msg(f'{self.desc} on port {self.bind_port} not running') return True diff --git a/test/start-coin-daemons.py b/test/start-coin-daemons.py index 1e70def6..99a4b5b2 100755 --- a/test/start-coin-daemons.py +++ b/test/start-coin-daemons.py @@ -23,6 +23,7 @@ opts_data = { -p, --port-shift= Shift the RPC port by this number -s, --get-state Get the state of the daemon(s) and exit -t, --testing Testing mode. Print commands but don't execute them +-q, --quiet Produce quieter output -v, --verbose Produce more verbose output -W, --no-wait Don't wait for daemons to change state before exiting """, @@ -54,7 +55,7 @@ def run(network_id=None,proto=None,daemon_id=None): elif opt.testing: print(' '.join(getattr(d,action+'_cmd'))) else: - d.cmd(action) + d.cmd(action,quiet=opt.quiet) if 'all' in cmd_args or 'no_xmr' in cmd_args: if len(cmd_args) != 1: