Add --version option
This commit adds ``--version`` option for the command line. Change-Id: I8dee5fa2154dd083a04204c33989e6ee318046a6
This commit is contained in:
parent
0e90a6d7a3
commit
6a787ca764
@ -14,4 +14,4 @@ import pbr.version
|
||||
|
||||
|
||||
__version__ = pbr.version.VersionInfo(
|
||||
'bashate').version_string()
|
||||
'bashate').version_string_with_vcs()
|
||||
|
@ -22,6 +22,7 @@ import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import bashate
|
||||
from bashate import messages
|
||||
|
||||
MESSAGES = messages.MESSAGES
|
||||
@ -431,9 +432,16 @@ def main(args=None):
|
||||
parser.add_argument('-e', '--error',
|
||||
help='Rules to always error (rather than warn)')
|
||||
parser.add_argument('-v', '--verbose', action='store_true', default=False)
|
||||
parser.add_argument('--version', action='store_true',
|
||||
help='show bashate version number and exit',
|
||||
default=False)
|
||||
parser.add_argument('-s', '--show', action='store_true', default=False)
|
||||
opts = parser.parse_args(args)
|
||||
|
||||
if opts.version:
|
||||
print("bashate: %s" % bashate.__version__)
|
||||
sys.exit(0)
|
||||
|
||||
if opts.show:
|
||||
messages.print_messages()
|
||||
sys.exit(0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user