From faff3244108dae2d1469f83c00eb74f8bacced77 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Thu, 11 Dec 2014 11:58:29 +0000 Subject: Add tiny prototype of a command-line interface for lorry-controller I can never remember how the HTTP API works and users really shouldn't have to deal with it directly. --- lorryctl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lorryctl diff --git a/lorryctl b/lorryctl new file mode 100644 index 0000000..1be9341 --- /dev/null +++ b/lorryctl @@ -0,0 +1,25 @@ +# Prototype lorry-controller cli, to save remembering the HTTP API... + + +import cliapp +import requests + + +class CLI(cliapp.Application): + def cmd_promote(self, args): + '''Move a repo to the top of the processing queue.''' + + if len(args) != 1: + raise cliapp.AppException( + 'This command takes one argument: the repo to promote.') + + url = 'http://localhost:12765/1.0/move-to-top' + payload = {'path': args[0]} + r = requests.post(url, data=payload) + if r.ok: + print r.text + else: + raise cliapp.AppException(r) + + +CLI().run() -- cgit v1.2.1