all repos — py-vite @ 4749c6b9267600dc2acd86a04611c34b757fc96b

the original vite, written in python

refactor: move argument parsing to main func thing
Anirudh icyph0x@pm.me
Tue, 17 Apr 2018 21:18:55 +0530
commit

4749c6b9267600dc2acd86a04611c34b757fc96b

parent

a2ce44b273f3e270dd50db400fd3fb7551b6cd20

1 files changed, 17 insertions(+), 21 deletions(-)

jump to
M vite.pyvite.py

@@ -11,23 +11,6 @@ import os

from huepy import * -usage = lightblue('vite.py') + ' new [PATH]' -desc = green('A simple and minimal static site generator.') -parser = argparse.ArgumentParser(description=desc, usage=usage) -parser.add_argument('new', nargs='*', help='Create new Vite project.') - -if len(sys.argv) == 1: - parser.print_help() - sys.exit(1) - -try: - args = parser.parse_args() - project_path = args.new[1] -except IndexError: - parser.print_help() - sys.exit(1) - - def create_project(path): try: abs_path = pathlib.Path(path).resolve()

@@ -81,10 +64,23 @@

""") -def main(): +if __name__ == "__main__": + usage = lightblue('vite.py') + ' new [PATH]' + desc = green('A simple and minimal static site generator.') + parser = argparse.ArgumentParser(description=desc, usage=usage) + parser.add_argument('new', nargs='*', help='Create new Vite project.') + + if len(sys.argv) == 1: + parser.print_help() + sys.exit(1) + + try: + args = parser.parse_args() + project_path = args.new[1] + except IndexError: + parser.print_help() + sys.exit(1) + if args.new: create_project(project_path) - -if __name__ == "__main__": - main()