Skip to content

Instantly share code, notes, and snippets.

@pochemuto
Last active February 5, 2016 10:08
Show Gist options
  • Save pochemuto/60f29f0377bcd631a228 to your computer and use it in GitHub Desktop.
Save pochemuto/60f29f0377bcd631a228 to your computer and use it in GitHub Desktop.
Alfred Workflow Stript Template
#coding=utf
__author__ = u'pochemuto'
import sys, re
from workflow import Workflow, ICON_INFO
log = None
# http://www.deanishe.net/alfred-workflow/api/index.html
# wf.add_item(title, subtitle=u'', modifier_subtitles=None, arg=None, autocomplete=None, valid=False, uid=None, icon=None, icontype=None, type=None, largetext=None, copytext=None)
# wf.filter(query, items, key=<function <lambda>>, ascending=False, include_score=False, min_score=0, max_results=0, match_on=127, fold_diacritics=True)
def main(wf):
args = Args(wf.args)
wf.add_item(u"Template filter", u"subtitle", arg="result-1", valud=True, uid="result-1", icon=WEB
wf.send_feedback()
return 0
class Args:
"""
self.flag = self.get_arg(args, 0) == '--boolean-flag'
self.value = self.get_arg(args, 1)
"""
def __init__(self, args):
pass
@staticmethod
def get_arg(args, n, default=None):
return args[n] if len(args) > n else default
if __name__ == '__main__':
wf = Workflow()
log = wf.logger
sys.exit(wf.run(main))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment