all repos — py-vite @ 68bec45daf522e817b4421b3f64df1729c927747

the original vite, written in python

refactor: no more build command
Anirudh icyph0x@protonmail.com
Sat, 14 Apr 2018 10:35:31 +0530
commit

68bec45daf522e817b4421b3f64df1729c927747

parent

b23f017cf4be350509cb13aeb58bab0a8acf6978

1 files changed, 5 insertions(+), 15 deletions(-)

jump to
M vite/vite.pyvite/vite.py

@@ -14,9 +14,10 @@

parser = argparse.ArgumentParser(description=""" A simple and minimal static site generator. """) -parser.add_argument('action', choices=['new', 'build']) +parser.add_argument('new', nargs='*',help='Create new Vite project.') +print(parser.parse_args()) # TODO: add help for each action -parser.add_argument('path', nargs='*') +# parser.add_argument('path', nargs='*') if len(sys.argv) == 1: parser.print_help()

@@ -24,7 +25,7 @@ sys.exit(1)

try: args = parser.parse_args() - project_path = args.path[0] + project_path = args.new[1] except IndexError: parser.print_help() sys.exit(1)

@@ -83,20 +84,9 @@

""") -def build_project(path): - try: - os.chdir(path) - import make - except FileNotFoundError: - print(bad('Error: no such file or directory: %s' % (path))) - - def main(): - if args.action == 'new': + if args.new: create_project(project_path) - elif args.action == 'build': - build_project(project_path) - if __name__ == "__main__": main()