From 25e8d49d7f4bd79e4025dba18b43c2fad40cd299 Mon Sep 17 00:00:00 2001 From: Seblu Date: Mon, 14 Feb 2011 12:11:24 +0100 Subject: [PATCH] add default usage for OptionCommand fix args check for command clear and history --- cccli/command/command.py | 1 + cccli/command/shell.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cccli/command/command.py b/cccli/command/command.py index ca810bc..1b40c26 100644 --- a/cccli/command/command.py +++ b/cccli/command/command.py @@ -43,6 +43,7 @@ class OptionCommand(Command): def __init__(self, cli, argv0): Command.__init__(self, cli, argv0) self.optionparser = OptionCommand.OptionCommandParser(prog=argv0) + self.set_usage("%prog [options]") self.options = None self.args = list() diff --git a/cccli/command/shell.py b/cccli/command/shell.py index 7fc5549..19c48ca 100644 --- a/cccli/command/shell.py +++ b/cccli/command/shell.py @@ -29,6 +29,8 @@ class Command_version(Command): class Command_history(Command): '''Show commands history''' def __call__(self, argv): + if len(argv) != 1: + raise cmdBadArgument() if not self.printer.history: raise cmdError("not available") for l in self.printer.history: @@ -39,6 +41,8 @@ class Command_clear(Command): '''Clear tty''' def __call__(self, argv): + if len(argv) != 1: + raise cmdBadArgument() self.printer.out("\033[H\033[2J", nl="") -- GitLab