Skip to content

Commit

Permalink
add version argument
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoMF committed Aug 18, 2023
1 parent cb1c101 commit c23ff92
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gepetuto/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import os
import sys
from importlib.metadata import metadata
from pathlib import Path
from subprocess import check_call

Expand Down Expand Up @@ -73,6 +74,11 @@ def parse_args(args=None) -> argparse.Namespace:
default="",
help="choose directory to run action on.",
)
parser.add_argument(
"--version",
action="store_true",
help="Get gepetuto version.",
)

args = parser.parse_args(args=args)

Expand Down Expand Up @@ -137,12 +143,23 @@ def get_files(args):
return files


def show_version():
"""Print gepetuto version."""
__metadata__ = metadata("gepetuto")
__version__ = __metadata__["version"]
print("gepetuto ", __version__)


def main():
"""Run command."""
args = parse_args()
if args.version:
show_version()
return
if args.directory:
os.chdir(args.directory)
args = parse_args()

files = get_files(args)
if args.action == "generate":
generate(**vars(args))
Expand Down

0 comments on commit c23ff92

Please sign in to comment.