start-coin-daemons.py: add --quiet option

This commit is contained in:
The MMGen Project 2021-08-02 19:47:52 +00:00
commit c01863ab13
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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: