TASK fix flags
This commit is contained in:
1 parent
9548414a69
commit
41040f1b3e
1 file changed
+5
-5
@@ -6,9 +6,9 @@ import argparse
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(description="A python project preparator for Linux")
|
parser = argparse.ArgumentParser(description="A python project preparator for Linux")
|
||||||
|
|
||||||
parser.add_argument('-n','--name',action='store_const',default='NewProject',const='NewProject',help='The project name')
|
parser.add_argument('-n','--name',default='NewProject',help='The project name')
|
||||||
parser.add_argument('-p','--path',action='store_const',default=False,const=False,help='The path to create the project in')
|
parser.add_argument('-p','--path',default=False,help='The path to create the project in')
|
||||||
parser.add_argument('-f','--filename',action='store_const',default='main.py',const='main.py',help="Initial file name")
|
parser.add_argument('-f','--filename',default='main.py',help="Initial file name")
|
||||||
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')
|
||||||
|
|
||||||
args = parser.parse_args(sys.argv[1:])
|
args = parser.parse_args(sys.argv[1:])
|
||||||
@@ -16,8 +16,8 @@ args = parser.parse_args(sys.argv[1:])
|
|||||||
if not args.path :
|
if not args.path :
|
||||||
path = Path().cwd()
|
path = Path().cwd()
|
||||||
else :
|
else :
|
||||||
dest = args.path if args.path[0]=='~' else Path.home() + args.path[1:]
|
dest = args.path if args.path[0]!='~' else Path.home().as_posix() + args.path[1:]
|
||||||
path = Path(dest+f"/{args.name}")
|
path = Path(dest)
|
||||||
|
|
||||||
if not path.exists() and path.is_file() :
|
if not path.exists() and path.is_file() :
|
||||||
raise Exception('Path does not exist')
|
raise Exception('Path does not exist')
|
||||||
|
|||||||
Reference in new issue
Block a user