Skip to content

Commit

Permalink
Merge pull request Gepetto#60 from TheoMF/version_argument
Browse files Browse the repository at this point in the history
Version argument
  • Loading branch information
nim65s authored Aug 18, 2023
2 parents 1bbd917 + c23ff92 commit 73ed5f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- add version argument

## [v1.2.0] - 2023-08-17

- add directory argument
Expand Down
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 73ed5f9

Please sign in to comment.