Merge "Adds console script and fix command line parsing"
This commit is contained in:
		@@ -117,26 +117,24 @@ class CratonShell(object):
 | 
			
		||||
        )
 | 
			
		||||
        self.parser = subcommand_parser
 | 
			
		||||
 | 
			
		||||
        if options.help or not argv:
 | 
			
		||||
        if options.help or ('help' in argv) or not argv:
 | 
			
		||||
            parser.print_help()
 | 
			
		||||
            return 0
 | 
			
		||||
 | 
			
		||||
        args = subcommand_parser.parse_args(argv)
 | 
			
		||||
 | 
			
		||||
        session = craton.Session(
 | 
			
		||||
            username=args.os_username,
 | 
			
		||||
            token=args.os_password,
 | 
			
		||||
            project_id=args.craton_project_id,
 | 
			
		||||
        )
 | 
			
		||||
        self.cc = client.Client(session, args.craton_url)
 | 
			
		||||
 | 
			
		||||
        args.func(self.cc, args)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    """Main entry-point for cratonclient's CLI."""
 | 
			
		||||
    try:
 | 
			
		||||
        CratonShell().main(map(encodeutils.safe_decode, sys.argv[1:]))
 | 
			
		||||
        CratonShell().main([encodeutils.safe_decode(a) for a in sys.argv[1:]])
 | 
			
		||||
    except Exception as e:
 | 
			
		||||
        print("ERROR: %s" % encodeutils.safe_encode(six.text_type(e)),
 | 
			
		||||
              file=sys.stderr)
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,10 @@ classifier =
 | 
			
		||||
packages =
 | 
			
		||||
    cratonclient
 | 
			
		||||
 | 
			
		||||
[entry_points]
 | 
			
		||||
console_scripts =
 | 
			
		||||
    craton = cratonclient.shell.main:main
 | 
			
		||||
 | 
			
		||||
[build_sphinx]
 | 
			
		||||
source-dir = doc/source
 | 
			
		||||
build-dir = doc/build
 | 
			
		||||
@@ -43,4 +47,4 @@ input_file = cratonclient/locale/cratonclient.pot
 | 
			
		||||
[extract_messages]
 | 
			
		||||
keywords = _ gettext ngettext l_ lazy_gettext
 | 
			
		||||
mapping_file = babel.cfg
 | 
			
		||||
output_file = cratonclient/locale/cratonclient.pot
 | 
			
		||||
output_file = cratonclient/locale/cratonclient.pot
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user