Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 3e6d3ce8a4
Fetching contributors…

Cannot retrieve contributors at this time

executable file 43 lines (35 sloc) 1.406 kB
import argparse
import sys
import commands
import config as config
import marketplace
commands = {'validate_manifest': app.commands.validate_manifest,
'is_manifest_valid': app.commands.is_manifest_valid,
'create': app.commands.create,
'status': app.commands.status,
'update': app.commands.update,
'add_screenshot': app.commands.add_screenshot,
'get_screenshot': app.commands.get_screenshot,
'del_screenshot': app.commands.del_screenshot,
'get_categories': app.commands.get_categories}
parser = argparse.ArgumentParser(description='Command line Marketplace client')
parser.add_argument('method', type=str, help='command to be run on arguments',
choices=commands.keys())
parser.add_argument('attrs', metavar='attr', type=str, nargs='*',
help='command arguments')
args = parser.parse_args()
client = marketplace.Client(
domain=config.MARKETPLACE_DOMAIN,
protocol=config.MARKETPLACE_PROTOCOL,
port=config.MARKETPLACE_PORT,
consumer_key=config.CONSUMER_KEY,
consumer_secret=config.CONSUMER_SECRET)
if args.attrs:
result = commands[args.method](client, *args.attrs)
else:
result = commands[args.method](client)
if result['success']:
sys.stdout.write('%s\n' % result['message'])
else:
sys.stderr.write('%s\n' % result['message'])
sys.exit(1)
Jump to Line
Something went wrong with that request. Please try again.