Skip to content

Commit

Permalink
[Implement #4] Add argument in cli to print version
Browse files Browse the repository at this point in the history
  • Loading branch information
tchambaretaud committed Apr 13, 2024
1 parent 9eb4ebc commit 2d0472b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/resetTolkien/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import datetime

from resetTolkien.resetTolkien import ResetTolkien
from resetTolkien import version
from resetTolkien.format import Formatter
from resetTolkien.utils import SplitArgs, SERVER_DATE_FORMAT, server_date_example
from resetTolkien.constants import (
Expand Down Expand Up @@ -88,6 +89,10 @@
main_parser = argparse.ArgumentParser(description=PROG_DESCRIPTION)
action_subparser = main_parser.add_subparsers(title="action", dest="action")

main_parser.add_argument(
"-v", "--version", help="Print tool version", action="store_true"
)

# DETECT

detect_parser = action_subparser.add_parser(
Expand Down Expand Up @@ -254,6 +259,10 @@
def main():
args = main_parser.parse_args()

if args.version:
print(version)
exit()

if not args.action:
main_parser.print_help()
exit()
Expand Down

0 comments on commit 2d0472b

Please sign in to comment.