mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
feat(main): add completions to cli
Uses `argcomplete` to add basic completions to the cli.
This commit is contained in:
parent
7c69730ad2
commit
c3068fe222
2 changed files with 6 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import argcomplete
|
||||||
|
|
||||||
import pre_commit.constants as C
|
import pre_commit.constants as C
|
||||||
from pre_commit import color
|
from pre_commit import color
|
||||||
from pre_commit import five
|
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
|
# argparse doesn't really provide a way to use a `default` subparser
|
||||||
if len(argv) == 0:
|
if len(argv) == 0:
|
||||||
argv = ['run']
|
argv = ['run']
|
||||||
|
|
||||||
|
argcomplete.autocomplete(parser)
|
||||||
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
if args.command == 'help' and args.help_cmd:
|
if args.command == 'help' and args.help_cmd:
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ install_requires =
|
||||||
virtualenv>=15.2
|
virtualenv>=15.2
|
||||||
futures; python_version<"3.2"
|
futures; python_version<"3.2"
|
||||||
importlib-resources; python_version<"3.7"
|
importlib-resources; python_version<"3.7"
|
||||||
|
argcomplete
|
||||||
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
|
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
|
||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue