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"]
|
||||
if "exe" not in fetch:
|
||||
return ("No fetch exe", {})
|
||||
return (
|
||||
None,
|
||||
{
|
||||
"action": parsed["action"],
|
||||
"env": parsed["env"],
|
||||
},
|
||||
)
|
||||
config = {
|
||||
"action": parsed["action"]
|
||||
}
|
||||
if "env" in parsed:
|
||||
config["env"] = parsed["env"]
|
||||
return (None, config)
|
||||
|
||||
|
||||
def wsgi():
|
||||
|
@ -13,7 +13,8 @@ if args.action == "fetch":
|
||||
"id": "updateme",
|
||||
"title": "The count is at 1",
|
||||
"action": {
|
||||
"increment": 1
|
||||
"increment": 1,
|
||||
"decrement": "",
|
||||
}
|
||||
}))
|
||||
|
||||
@ -24,4 +25,11 @@ if args.action == "increment":
|
||||
item["body"] = f"<p>{item['action']['increment']}</p>"
|
||||
item["title"] = f"The count is at {item['action']['increment']}"
|
||||
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": {
|
||||
"fetch": {
|
||||
"exe": "./increment.py",
|
||||
"args": ["fetch"]
|
||||
"args": [
|
||||
"fetch"
|
||||
]
|
||||
},
|
||||
"increment": {
|
||||
"exe": "./increment.py",
|
||||
"args": ["increment"]
|
||||
"args": [
|
||||
"increment"
|
||||
]
|
||||
},
|
||||
"decrement": {
|
||||
"exe": "./increment.py",
|
||||
"args": [
|
||||
"decrement"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user