feat(main): add completions to cli

Uses `argcomplete` to add basic completions to the cli.
This commit is contained in:
Rich Lewis 2019-08-15 13:48:36 +01:00
parent 7c69730ad2
commit c3068fe222
No known key found for this signature in database
GPG key ID: 3879CC0B8FDE811F
2 changed files with 6 additions and 0 deletions

View file

@ -5,6 +5,8 @@ import logging
import os
import sys
import argcomplete
import pre_commit.constants as C
from pre_commit import color
from pre_commit import five
@ -268,6 +270,9 @@ def main(argv=None):
# argparse doesn't really provide a way to use a `default` subparser
if len(argv) == 0:
argv = ['run']
argcomplete.autocomplete(parser)
args = parser.parse_args(argv)
if args.command == 'help' and args.help_cmd:

View file

@ -35,6 +35,7 @@ install_requires =
virtualenv>=15.2
futures; python_version<"3.2"
importlib-resources; python_version<"3.7"
argcomplete
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
[options.entry_points]