Skip to content

Commit

Permalink
Merge pull request #7 from 0018akhil/master
Browse files Browse the repository at this point in the history
Added --version argument
  • Loading branch information
HushmKun authored Jun 19, 2023
2 parents 76eeac3 + 47455ae commit 4ce3870
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion artec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def main():
args = main_args()
args = main_args(__version__)

builder = boiler_builder(args.source, args.target,args.verbose)

Expand Down
15 changes: 12 additions & 3 deletions artec/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@


class Parser(ArgumentParser):
def __init__(self):
def __init__(self, appVersion):
self.appVersion = appVersion
prog = "Artec"
usage = "artec [OPTIONS] -o [DEST] "
description = "Artec is a simple python 3 script to create a project template in a given directory."
Expand Down Expand Up @@ -52,8 +53,16 @@ def setup(self):
required=False,
)

def main_args() -> Namespace:
parser = Parser()
self.add_argument(
"-V",
"--version",
help="Display current version of Artec",
action="version",
version=f"{self.prog} {self.appVersion}"
)

def main_args(appVersion) -> Namespace:
parser = Parser(appVersion)
parser.setup()
return parser.parse_args()

Expand Down
2 changes: 1 addition & 1 deletion test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class ParserTest(unittest.TestCase):
def setUp(self):
self.parser = argparser.Parser()
self.parser = argparser.Parser("appVersion")
self.parser.setup()

def test_arg_target(self):
Expand Down

0 comments on commit 4ce3870

Please sign in to comment.