mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #116 from pre-commit/version_command
Add -V / --version
This commit is contained in:
commit
92aa55f44e
1 changed files with 10 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import pkg_resources
|
||||||
|
|
||||||
from pre_commit import color
|
from pre_commit import color
|
||||||
from pre_commit.commands.autoupdate import autoupdate
|
from pre_commit.commands.autoupdate import autoupdate
|
||||||
|
|
@ -16,6 +17,15 @@ from pre_commit.util import entry
|
||||||
def main(argv):
|
def main(argv):
|
||||||
parser = argparse.ArgumentParser()
|
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 = parser.add_subparsers(dest='command')
|
||||||
|
|
||||||
subparsers.add_parser('install', help='Intall the pre-commit script.')
|
subparsers.add_parser('install', help='Intall the pre-commit script.')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue