Added -P/--output-pill argument (#6)

This commit is contained in:
benjamin-tlon 2019-02-26 14:08:32 -08:00 committed by GitHub
parent 5062abe789
commit 29a2e6a79e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

7
urb
View File

@ -251,6 +251,8 @@ class sinkAction(argparse.Action):
def construct_value(self, new_value):
if self.which == 'output-file':
return {self.which: new_value[::-1].replace('.','/',1)[::-1]}
elif self.which == 'output-pill':
return {self.which: new_value[::-1].replace('.','/',1)[::-1]}
else:
return {self.which: new_value}
@ -334,6 +336,9 @@ sinks.add_argument('-s', '--stdout', const={'stdout': None},
sinks.add_argument('-f', '--output-file', which='output-file',
metavar='path',
action=sinkAction)
sinks.add_argument('-P', '--output-pill', which='output-pill',
metavar='path',
action=sinkAction)
sinks.add_argument('-C', '--output-clay', which='output-clay',
metavar='clay-path',
action=sinkAction)
@ -382,7 +387,9 @@ else:
sys.exit(1)
url = "http://localhost:%s" % PORT
r = requests.post(url, data=json.dumps(payload))
if r.text[0] == '"':
print r.text[1:-1].decode('string_escape')
elif r.text[0] == '{':