Loading cccli/commands/watch.py +4 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ class Command_watch(OptionCommand): def __init__(self, cli, argv0): OptionCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] command [options]") self.add_option("-n", "--interval", dest="seconds", type="float", default=1.0, self.add_option("-n", "--interval", dest="interval", type="float", default=1.0, help="Define interval in seconds") def __call__(self, argv): Loading @@ -28,6 +28,8 @@ class Command_watch(OptionCommand): self.parse_args(argv) if len(self.args) == 0: raise cmdBadArgument() if self.options.interval < 0.5: raise cmdBadArgument("Interval must be >= 0.5") while True: # Substitute aliases self.args = self.cli.aliases.substitute(self.args) Loading @@ -41,7 +43,7 @@ class Command_watch(OptionCommand): # Print the buffer self.printer.out(sys.stdout.getvalue(), fd=sys.__stdout__) # Wait time.sleep(self.options.seconds) time.sleep(self.options.interval) except KeyboardInterrupt: raise except cliException: Loading Loading
cccli/commands/watch.py +4 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ class Command_watch(OptionCommand): def __init__(self, cli, argv0): OptionCommand.__init__(self, cli, argv0) self.set_usage("%prog [options] command [options]") self.add_option("-n", "--interval", dest="seconds", type="float", default=1.0, self.add_option("-n", "--interval", dest="interval", type="float", default=1.0, help="Define interval in seconds") def __call__(self, argv): Loading @@ -28,6 +28,8 @@ class Command_watch(OptionCommand): self.parse_args(argv) if len(self.args) == 0: raise cmdBadArgument() if self.options.interval < 0.5: raise cmdBadArgument("Interval must be >= 0.5") while True: # Substitute aliases self.args = self.cli.aliases.substitute(self.args) Loading @@ -41,7 +43,7 @@ class Command_watch(OptionCommand): # Print the buffer self.printer.out(sys.stdout.getvalue(), fd=sys.__stdout__) # Wait time.sleep(self.options.seconds) time.sleep(self.options.interval) except KeyboardInterrupt: raise except cliException: Loading