-
Notifications
You must be signed in to change notification settings - Fork 9
/
del.py
40 lines (31 loc) · 923 Bytes
/
del.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding:utf-8 -*-
import json,sys
from workflow.workflow3 import Workflow
subtitle = 'Remove currency from panel'
"""
push item into item class
"""
def push_item(item_title,item_subtitle,flag,value):
wf.add_item(title=item_title,
subtitle=item_subtitle,
icon='flags/{0}.png'.format(flag),
valid='yes',
arg=str(value)+" del")
def main(wf):
args = wf.args
args = [x.upper() for x in args]
length = len(args)
f = open('config.json', 'r')
j_config = json.load(f)
if length == 0:
for e in j_config['units']:
push_item(e, subtitle, e, e)
if length == 1:
for key in j_config['units']:
if key.startswith(args[0]):
push_item(key, subtitle, key, key)
wf.send_feedback()
if __name__ == '__main__':
wf = Workflow()
log = wf.logger
sys.exit(wf.run(main))