mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Add -V / --version
This commit is contained in:
parent
e47119d2a8
commit
a7506061bd
1 changed files with 10 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import argparse
|
||||
import pkg_resources
|
||||
|
||||
from pre_commit import color
|
||||
from pre_commit.commands.autoupdate import autoupdate
|
||||
|
|
@ -16,6 +17,15 @@ from pre_commit.util import entry
|
|||
def main(argv):
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
# http://stackoverflow.com/a/8521644/812183
|
||||
parser.add_argument(
|
||||
'-V', '--version',
|
||||
action='version',
|
||||
version='%(prog)s {0}'.format(
|
||||
pkg_resources.get_distribution('pre-commit').version
|
||||
)
|
||||
)
|
||||
|
||||
subparsers = parser.add_subparsers(dest='command')
|
||||
|
||||
subparsers.add_parser('install', help='Intall the pre-commit script.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue