Add a flag to output version
This commit is contained in:
1 parent
21f0e81856
commit
e38b27a8a7
1 file changed
+8
@@ -5,6 +5,9 @@ import sys
|
|||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
if __name__ == '__main__' :
|
if __name__ == '__main__' :
|
||||||
|
|
||||||
|
VERSION = 'v0.1'
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="A Python project preparer for Linux")
|
parser = argparse.ArgumentParser(description="A Python project preparer for Linux")
|
||||||
|
|
||||||
parser.add_argument('-n','--name',default='NewProject',help='The project name')
|
parser.add_argument('-n','--name',default='NewProject',help='The project name')
|
||||||
@@ -12,9 +15,14 @@ if __name__ == '__main__' :
|
|||||||
parser.add_argument('-f','--filename',default='main.py',help="Initial file name")
|
parser.add_argument('-f','--filename',default='main.py',help="Initial file name")
|
||||||
parser.add_argument('--file-preset',default='',help='Choose a preset for the init file: print | class | import')
|
parser.add_argument('--file-preset',default='',help='Choose a preset for the init file: print | class | import')
|
||||||
parser.add_argument('-g','--git',action='store_true',help='If "git init" should be used')
|
parser.add_argument('-g','--git',action='store_true',help='If "git init" should be used')
|
||||||
|
parser.add_argument('--version',action='store_true',help='Print the current version')
|
||||||
|
|
||||||
args = parser.parse_args(sys.argv[1:])
|
args = parser.parse_args(sys.argv[1:])
|
||||||
|
|
||||||
|
if args.version :
|
||||||
|
print(f"Linux Python Preparer {VERSION}")
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
if not args.path :
|
if not args.path :
|
||||||
path = Path().cwd()
|
path = Path().cwd()
|
||||||
else :
|
else :
|
||||||
|
|||||||
Reference in new issue
Block a user