Skip to content

Commit

Permalink
Add --version option
Browse files Browse the repository at this point in the history
Fixes: #42
  • Loading branch information
andrewshadura committed Mar 24, 2022
1 parent eda2377 commit e86a962
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions git_crecord/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later

import argparse
import importlib.metadata
import os
import sys
import tempfile
Expand Down Expand Up @@ -179,6 +180,7 @@ def commit(self, *files, **opts):

def main():
prog = os.path.basename(sys.argv[0]).replace('-', ' ')
version = importlib.metadata.version("git-crecord")

subcommand = prog.split(' ')[-1].replace('.py', '')

Expand Down Expand Up @@ -212,6 +214,7 @@ def main():
parser.add_argument('--quiet', default=False, action='store_true', help='pass --quiet to git commit')
parser.add_argument('--confirm', default=False, action='store_true',
help='show confirmation prompt after selecting changes')
parser.add_argument('--version', action='version', version=f'%(prog)s {version}')
group = parser.add_mutually_exclusive_group()
group.add_argument('--cached', '--staged', action='store_true', default=False, help=argparse.SUPPRESS)
group.add_argument('--index', action='store_true', default=False, help=argparse.SUPPRESS)
Expand Down

0 comments on commit e86a962

Please # to comment.