def main(): parser = ArgumentParser() load_mount_parser_args(parser) args = parser.parse_args() option_string = args.opt[0] if args.opt else None try: mount(auth_storage_filepath=args.auth_storage_file, mountpoint=args.mountpoint, debug=args.debug, nothreads=args.debug, option_string=option_string) except (Exception) as e: message = ("Could not do mount [%s]: %s" % (e.__class__.__name__, str(e))) logging.exception(message) print(message)
parser = ArgumentParser() subparsers = parser.add_subparsers(help='subcommand help') parser_auth = subparsers.add_parser('auth', help='Authorization subcommand.') auth_xor = parser_auth.add_mutually_exclusive_group(required=True) auth_xor.add_argument('-u', '--url', help='Get an authorization URL.', action='store_true') auth_xor.add_argument('-a', '--auth', nargs=2, metavar=('auth_storage_file', 'authcode'), help='Register an authorization-code from Google ' 'Drive.') mount_auth = subparsers.add_parser('mount', help='Mounting subcommand.') load_mount_parser_args(mount_auth) args = parser.parse_args() # An authorization URL was requested. if 'url' in args and args.url: try: authorize = get_auth() url = authorize.step1_get_auth_url() except Exception as e: print("Could not produce auth-URL: %s" % (e)) exit() print("To authorize FUSE to use your Google Drive account, visit the " "following URL to produce an authorization code:\n\n%s\n" % (url))
parser_auth = subparsers.add_parser('auth', help='Authorization subcommand.') auth_xor = parser_auth.add_mutually_exclusive_group(required=True) auth_xor.add_argument('-u', '--url', help='Get an authorization URL.', action='store_true') auth_xor.add_argument('-a', '--auth', nargs=2, metavar=('auth_storage_file', 'authcode'), help='Register an authorization-code from Google ' 'Drive.') mount_auth = subparsers.add_parser('mount', help='Mounting subcommand.') load_mount_parser_args(mount_auth) args = parser.parse_args() # An authorization URL was requested. if 'url' in args and args.url: try: authorize = get_auth() url = authorize.step1_get_auth_url() except Exception as e: print("Could not produce auth-URL: %s" % (e)) exit() print("To authorize FUSE to use your Google Drive account, visit the " "following URL to produce an authorization code:\n\n%s\n" % (url))