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)
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)
def set_io(args): params = {'name': args.name, 'val': args.val} r = req.send('set', params) print(r.text)
def get_io(args): params = {'name': args.name} r = req.send('get', params) print(r.text)
def reset(args): r = req.send('reset') print(r.text)
def sim_list(args): r = req.send('list') sims = json.loads(r.text) print('Running sims:') for sim in sims: print(sim)
def sims(args): r = req.send('sims') sims = json.loads(r.text) print('Available sims:') for sim in sims: print(sim)
def stop(args): params = {'sim': args.sim} r = req.send('stop', params) print(r.text)
def start(args): params = {'sim': args.sim, 'proj': args.proj} r = req.send('start', params) print(r.text)