Пример #1
0
def view(args):
    params = {'sim': args.sim, 'type': args.store_type, 'key': args.key}
    r = req.send('view', params)
    if r.status_code == 200:
        pprint.pprint(json.loads(r.text), indent=2)
    else:
        print(r.text)
Пример #2
0
def update(args):
    params = {'sim': args.sim, 'type': args.store_type, 'key': args.key}
    r = req.send('view', params)
    if r.status_code != 200:
        print(r.text)
        return
    tf = tempfile.NamedTemporaryFile(suffix='.tmp')
    tf.write(r.text.encode())
    tf.flush()

    subprocess.call(['vim', tf.name])

    tf.seek(0)
    edited = tf.read().decode()

    r = req.send('apply', params, edited)
    print(r.text)
Пример #3
0
def set_io(args):
    params = {'name': args.name, 'val': args.val}
    r = req.send('set', params)
    print(r.text)
Пример #4
0
def get_io(args):
    params = {'name': args.name}
    r = req.send('get', params)
    print(r.text)
Пример #5
0
def reset(args):
    r = req.send('reset')
    print(r.text)
Пример #6
0
def sim_list(args):
    r = req.send('list')
    sims = json.loads(r.text)
    print('Running sims:')
    for sim in sims:
        print(sim)
Пример #7
0
def sims(args):
    r = req.send('sims')
    sims = json.loads(r.text)
    print('Available sims:')
    for sim in sims:
        print(sim)
Пример #8
0
def stop(args):
    params = {'sim': args.sim}
    r = req.send('stop', params)
    print(r.text)
Пример #9
0
def start(args):
    params = {'sim': args.sim, 'proj': args.proj}
    r = req.send('start', params)
    print(r.text)