diff options
| -rw-r--r-- | CHANGELOG.rst | 1 | ||||
| -rw-r--r-- | lesana/command.py | 7 | 
2 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index feec380..c01bd47 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,7 @@ Unreleased    entries, while ``lesana search`` with no other options will list the    first 12 entries (possibly according to a default sorting setting).  * New collection example: ticket_tracker. +* Add support for bash autocompletion via argcomplete, if installed.  Bugfixes  -------- diff --git a/lesana/command.py b/lesana/command.py index 4c723af..6914ca3 100644 --- a/lesana/command.py +++ b/lesana/command.py @@ -4,6 +4,11 @@ import os  import subprocess  import sys +try: +    import argcomplete +except ImportError as e: +    argcomplete = False +  from . import Collection, Entry, TemplatingError  logger = logging.getLogger(__name__) @@ -40,6 +45,8 @@ class MainCommand:              for arg in sub.arguments:                  s_parser.add_argument(*arg[0], **arg[1])              s_parser.set_defaults(func=sub._main) +        if argcomplete: +            argcomplete.autocomplete(self.parser)          self.args = self.parser.parse_args()          if self.args.verbose:  | 
