Browse Source

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

The MMGen Project 3 years ago
parent
commit
c01863ab13
2 changed files with 6 additions and 5 deletions
  1. 4 4
      mmgen/daemon.py
  2. 2 1
      test/start-coin-daemons.py

+ 4 - 4
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
 

+ 2 - 1
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: