Commit d651635f authored by Jacek Sowiński's avatar Jacek Sowiński

Import prompt-toolkit only if it's needed.

Also display more readable error message in case of absence of
prompt-toolkit.

This fixes #35
parent 51bf164f
...@@ -20,7 +20,6 @@ import sys ...@@ -20,7 +20,6 @@ import sys
import getopt import getopt
from topydo.cli.CLIApplicationBase import MAIN_OPTS, error from topydo.cli.CLIApplicationBase import MAIN_OPTS, error
from topydo.cli.CLI import CLIApplication from topydo.cli.CLI import CLIApplication
from topydo.cli.Prompt import PromptApplication
def main(): def main():
""" Main entry point of the CLI. """ """ Main entry point of the CLI. """
...@@ -34,7 +33,11 @@ def main(): ...@@ -34,7 +33,11 @@ def main():
sys.exit(1) sys.exit(1)
if args[0] == 'prompt': if args[0] == 'prompt':
PromptApplication().run() try:
from topydo.cli.Prompt import PromptApplication
PromptApplication().run()
except ImportError:
error("You have to install prompt-toolkit to run prompt mode.")
else: else:
CLIApplication().run() CLIApplication().run()
except IndexError: except IndexError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment