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: