Fix config editing
This commit is contained in:
parent
bd272c2e84
commit
70ee60bb65
|
@ -198,13 +198,12 @@ def try_parse_config(config_str: str):
|
||||||
fetch = action["fetch"]
|
fetch = action["fetch"]
|
||||||
if "exe" not in fetch:
|
if "exe" not in fetch:
|
||||||
return ("No fetch exe", {})
|
return ("No fetch exe", {})
|
||||||
return (
|
config = {
|
||||||
None,
|
"action": parsed["action"]
|
||||||
{
|
}
|
||||||
"action": parsed["action"],
|
if "env" in parsed:
|
||||||
"env": parsed["env"],
|
config["env"] = parsed["env"]
|
||||||
},
|
return (None, config)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def wsgi():
|
def wsgi():
|
||||||
|
|
|
@ -13,7 +13,8 @@ if args.action == "fetch":
|
||||||
"id": "updateme",
|
"id": "updateme",
|
||||||
"title": "The count is at 1",
|
"title": "The count is at 1",
|
||||||
"action": {
|
"action": {
|
||||||
"increment": 1
|
"increment": 1,
|
||||||
|
"decrement": "",
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -24,4 +25,11 @@ if args.action == "increment":
|
||||||
item["body"] = f"<p>{item['action']['increment']}</p>"
|
item["body"] = f"<p>{item['action']['increment']}</p>"
|
||||||
item["title"] = f"The count is at {item['action']['increment']}"
|
item["title"] = f"The count is at {item['action']['increment']}"
|
||||||
print(json.dumps(item))
|
print(json.dumps(item))
|
||||||
pass
|
|
||||||
|
if args.action == "decrement":
|
||||||
|
item = sys.stdin.readline()
|
||||||
|
item = json.loads(item)
|
||||||
|
item["action"]["increment"] -= 1
|
||||||
|
item["body"] = f"<p>{item['action']['increment']}</p>"
|
||||||
|
item["title"] = f"The count is at {item['action']['increment']}"
|
||||||
|
print(json.dumps(item))
|
||||||
|
|
|
@ -2,11 +2,21 @@
|
||||||
"action": {
|
"action": {
|
||||||
"fetch": {
|
"fetch": {
|
||||||
"exe": "./increment.py",
|
"exe": "./increment.py",
|
||||||
"args": ["fetch"]
|
"args": [
|
||||||
|
"fetch"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"increment": {
|
"increment": {
|
||||||
"exe": "./increment.py",
|
"exe": "./increment.py",
|
||||||
"args": ["increment"]
|
"args": [
|
||||||
|
"increment"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"decrement": {
|
||||||
|
"exe": "./increment.py",
|
||||||
|
"args": [
|
||||||
|
"decrement"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue