Skip to content

Commit

Permalink
Type is now optional
Browse files Browse the repository at this point in the history
  • Loading branch information
burdier committed Oct 12, 2019
1 parent 5a072dc commit 876102e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions flask_now/now.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def main():
parser = argparse.ArgumentParser()
parser.add_argument('name', help='Name of your project', type=str)
parser.add_argument('type', help='Type of project: Either Simple or Blueprints: (simple or bp)', type=str)
parser.add_argument('--type', help='Type of project: Either Simple or Blueprints: (simple or bp), simple is by default selected',type=str)
parser.add_argument('-e', '--extensions', help='list of extensions', nargs='+')
parser.add_argument('-p', '--python', help='Global python3 path', default=sys.executable)

Expand All @@ -33,16 +33,13 @@ def create_venv(global_python_path):
print('Virtualenvironment creation failed: {}'.format(process.stdout))


def create_example_app(app_name, app_type):
def create_example_app(app_name, app_type=None):
directory_name = pkg_resources.get_distribution('flask-now').location
if app_type == 'bp':
src = '{}/flask_now/templates/blueprints'.format(directory_name)
if app_type == 'simple':
src = '{}/flask_now/templates/simple'.format(directory_name)
boilerplate_code = {"bp":f'{directory_name}/flask_now/templates/blueprints',"simple":f'{directory_name}/flask_now/templates/simple'}
try:
if os.path.isdir(app_name):
shutil.rmtree(app_name)
shutil.copytree(src, app_name)
shutil.copytree(boilerplate_code.get(app_type,'simple'), app_name)

This comment has been minimized.

Copy link
@ozanonurtek

ozanonurtek Oct 19, 2019

Owner

Bug is here.

os.chdir(app_name)
except Exception as ex:
print(ex)
Expand Down

0 comments on commit 876102e

Please sign in to comment.