diff options
Diffstat (limited to 'pykolab/cli')
-rw-r--r-- | pykolab/cli/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py index 40fb20b..defa462 100644 --- a/pykolab/cli/__init__.py +++ b/pykolab/cli/__init__.py @@ -47,7 +47,11 @@ class Cli(object): self.conf.finalize_conf() # The first argument has to be a command - action = self.conf.args.pop(0) + try: + action = self.conf.args.pop(0) + except IndexError, e: + self.no_command() + action_function = action.replace('-','_') action_components = action.split('-') @@ -66,6 +70,10 @@ class Cli(object): self.print_usage() + def no_command(self): + print >> sys.stderr, _("No command given, see --help for details") + sys.exit(1) + def action_list_domains(self): ldap_con = ldap.initialize(self.conf.get('ldap', 'uri')) ldap_con.bind_s(self.conf.get('ldap', 'bind_dn'), self.conf.get('ldap', 'bind_pw')) |