1. Andy Mikhailenko
  2. argh


Andy Mikhailenko  committed 93e974b

Added a todo note.

  • Participants
  • Parent commits 1043fe8
  • Branches default

Comments (0)

Files changed (1)

File argh/helpers.py

View file
 import sys
 from types import GeneratorType
+from .exceptions import CommandError
 __all__ = ['ArghParser', 'add_commands', 'dispatch', 'confirm']
     # this will raise SystemExit if parsing fails
     args = parser.parse_args(argv)
+    if not hasattr(args, 'function'):
+        # FIXME: "./prog.py" hits this error while "./prog.py foo" doesn't
+        # if there were no commands defined for the parser (a possible case)
+        raise NotImplementedError('Cannot dispatch without commands')
     # try different ways of calling the command; if meanwhile it raises
     # CommandError, return the string representation of that error