def main():
argparser = argparse.ArgumentParser(<EOL>description='<STR_LIT>'.format(__version__))<EOL>subparsers = argparser.add_subparsers(<EOL>dest='<STR_LIT:action>', help='<STR_LIT>')<EOL>parser = subparsers.add_parser(<EOL>'<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>' % CONFIG_PATH)<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>'),<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser = subparsers.add_parser(<EOL>'<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>' % CONFIG_PATH)<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>'),<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser = subparsers.add_parser(<EOL>'<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>' % CONFIG_PATH)<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>'),<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>', nargs='<STR_LIT:?>',<EOL>help='<STR_LIT>')<EOL>parser = subparsers.add_parser(<EOL>'<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>' % CONFIG_PATH)<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>'),<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser = subparsers.add_parser(<EOL>'<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>' % CONFIG_PATH)<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>'),<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument(<EOL>'<STR_LIT>', action='<STR_LIT:store>',<EOL>help='<STR_LIT>')<EOL>args, unparsed = argparser.parse_known_args()<EOL>config_path = args.config<EOL>if config_path is None:<EOL><INDENT>config_path = CONFIG_PATH<EOL><DEDENT>conf = get_config( config_path )<EOL>config_dir = os.path.dirname(config_path)<EOL>blockchain_id = getattr(args, "<STR_LIT>", None)<EOL>hostname = getattr(args, "<STR_LIT>", None)<EOL>passphrase = getattr(args, "<STR_LIT>", None)<EOL>data_name = getattr(args, "<STR_LIT>", None)<EOL>wallet_path = getattr(args, "<STR_LIT>", None)<EOL>if blockchain_id is None:<EOL><INDENT>blockchain_id = conf['<STR_LIT>']<EOL><DEDENT>if hostname is None:<EOL><INDENT>hostname = conf['<STR_LIT>']<EOL><DEDENT>if wallet_path is None:<EOL><INDENT>wallet_path = conf['<STR_LIT>']<EOL><DEDENT>if wallet_path is None and config_dir is not None:<EOL><INDENT>wallet_path = os.path.join(config_dir, blockstack_client.config.WALLET_FILENAME)<EOL><DEDENT>if wallet_path is not None and os.path.exists( wallet_path ):<EOL><INDENT>log.debug("<STR_LIT>" % wallet_path)<EOL>wallet = blockstack_client.load_wallet( config_dir=config_dir, wallet_path=wallet_path, include_private=True )<EOL>if '<STR_LIT:error>' in wallet:<EOL><INDENT>print(json.dumps(wallet, sort_keys=True, indent=<NUM_LIT:4> ), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>wallet = wallet['<STR_LIT>']<EOL><DEDENT><DEDENT>else:<EOL><INDENT>log.debug("<STR_LIT>")<EOL>wallet = blockstack_client.dump_wallet(config_path=config_path)<EOL>if '<STR_LIT:error>' in wallet:<EOL><INDENT>print(json.dumps(wallet, sort_keys=True, indent=<NUM_LIT:4>), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>log.debug("<STR_LIT>" %  args.action)<EOL>if args.action in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>res = file_key_regenerate( blockchain_id, hostname, config_path=config_path, wallet_keys=wallet ) <EOL>if '<STR_LIT:error>' in res:<EOL><INDENT>print(json.dumps(res, sort_keys=True, indent=<NUM_LIT:4> ), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>if args.action == '<STR_LIT>':<EOL><INDENT>sender_blockchain_id = args.sender_blockchain_id<EOL>output_path = args.output_path<EOL>tmp = False<EOL>if output_path is None:<EOL><INDENT>fd, path = tempfile.mkstemp( prefix='<STR_LIT>', dir=config_dir )<EOL>os.close(fd)<EOL>output_path = path<EOL>tmp = True<EOL><DEDENT>res = file_get( blockchain_id, hostname, sender_blockchain_id, data_name, output_path, passphrase=passphrase, config_path=config_path, wallet_keys=wallet )<EOL>if '<STR_LIT:error>' in res:<EOL><INDENT>print(json.dumps(res, sort_keys=True, indent=<NUM_LIT:4> ), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>if tmp:<EOL><INDENT>with open(output_path, "<STR_LIT:r>") as f:<EOL><INDENT>while True:<EOL><INDENT>buf = f.read(<NUM_LIT>)<EOL>if len(buf) == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT>sys.stdout.write(buf)<EOL><DEDENT><DEDENT>os.unlink(output_path)<EOL><DEDENT><DEDENT>elif args.action == '<STR_LIT>':<EOL><INDENT>recipients = unparsed<EOL>input_path = args.input_path<EOL>res = file_put( blockchain_id, hostname, recipients, data_name, input_path, passphrase=passphrase, config_path=config_path, wallet_keys=wallet )<EOL>if '<STR_LIT:error>' in res:<EOL><INDENT>print(json.dumps(res, sort_keys=True, indent=<NUM_LIT:4> ), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>elif args.action == '<STR_LIT>':<EOL><INDENT>res = file_delete( blockchain_id, data_name, config_path=config_path, wallet_keys=wallet )<EOL>if '<STR_LIT:error>' in res:<EOL><INDENT>print(json.dumps(res, sort_keys=True, indent=<NUM_LIT:4> ), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>print(json.dumps({'<STR_LIT:status>': True}, sort_keys=True, indent=<NUM_LIT:4> ), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:0>)<EOL>
Entry point for the CLI interface