def main(): try: command = sys.arg[1] except: print(usage) return if command == 'build': build() elif command == 'new': new()
def main(): print("This is argv:", sys.argv) command = sys.argv[1] print(command) if command == "build": print("Build was specified") utils.build() elif command == "new": print("New page was specified") utils.new() else: print("Please specify 'build' or 'new'")
def main(): try: command = sys.argv[1] except: print(USAGE) return if command == 'build': build() elif command == 'new': new() else: print(USAGE) return
import utils import sys #run-------------- if __name__ == "__main__": print("This is argv:", sys.argv) if len(sys.argv) > 1: command = sys.argv[1] if command == "build": print("Build was specified") utils.build() print( "Your content pages are now templated into your website design" ) elif command == "new": print("New page was specified") utils.new() print("A new content page has been created at content/new.html") else: print("Usage:") print(" To rebuild site: python manage.py build") print(" To create new page: python manage.py new") else: print("Usage:") print(" To rebuild site: python manage.py build") print(" To create new page: python manage.py new") #DRY... :/