Skip to content
Snippets Groups Projects
Commit aa8d1fa4 authored by Seblu's avatar Seblu
Browse files

watch interval is now limited to 0.5

to save the world from destruction and spoofin
parent 554b6d89
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......@@ -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)
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment