def main(wf):
# ?????????
params = (wf.args or [""])[0].strip().split(" ")
optype, param = params[0].strip(), " ".join(params[1:]).strip()
if not param:
wf.add_item(title=u"?????", subtitle="Cant\'t Empty!", icon=ICON_ERROR)
elif optype in CATEGORY_MAP:
conf = CATEGORY_MAP[optype]
try:
result = globals()[conf["func"]](param)
except Exception as ex:
result = ex.message
if isinstance(result, basestring):
wf.add_item(
title=u"{} ?{}?".format(conf["title"], param),
subtitle=result,
arg=result,
valid=True,
icon=ICON_INFO)
elif isinstance(result, list):
for item in result:
wf.add_item(
title=item["title"],
subtitle=item["cmd"],
arg=param,
valid=True,
icon=ICON_INFO)
else:
wf.add_item(title=u"?????????", subtitle="...", icon=ICON_ERROR)
else:
wf.add_item(title=u"????", subtitle="...", icon=ICON_ERROR)
wf.send_feedback()
评论列表
文章目录