Allow no options or args and just print usage. Return project so it's available with python -i refine.py

This commit is contained in:
Paul Makepeace 2011-06-08 17:07:39 +00:00
parent dfcf5e8978
commit 0883216e0f
1 changed files with 5 additions and 3 deletions

View File

@ -83,10 +83,10 @@ def main():
refine.REFINE_PORT = options.port refine.REFINE_PORT = options.port
if not options.list and len(args) != 1: if not options.list and len(args) != 1:
PARSER.error('expecting --list or project ID/URL') PARSER.print_usage()
if options.list: if options.list:
list_projects() list_projects()
else: if args:
project = refine.RefineProject(args[0]) project = refine.RefineProject(args[0])
if options.apply: if options.apply:
response = project.apply_operations(options.apply) response = project.apply_operations(options.apply)
@ -96,6 +96,8 @@ def main():
if options.export: if options.export:
export_project(project, options) export_project(project, options)
return project
if __name__ == '__main__': if __name__ == '__main__':
main() # return project so that it's available interactively, python -i refine.py
project = main()