diff --git a/src/cdn.py b/src/cdn.py index 170131f..9a1f0ff 100644 --- a/src/cdn.py +++ b/src/cdn.py @@ -1,16 +1,28 @@ import sys from workflow import Workflow, ICON_WEB, web -wf = Workflow() +UPDATE_SETTINGS = {'github_slug' : 'azai91/alfred-cdn-workflow'} +HELP_URL = 'https://github.com/azai91/alfred-cdn-workflow/issues' + +wf = Workflow(update_settings=UPDATE_SETTINGS, help_url=HELP_URL) + +URL = 'http://api.cdnjs.com/libraries?' + def main(_): - url = 'http://api.cdnjs.com/libraries?' + + if wf.update_available: + wf.add_item( + 'An update is available!', + autocomplete='workflow:update', + valid=False) + if len(wf.args): query = wf.args[0] else: query = None params = dict(search=query, fields='version,description') - r = web.get(url, params) + r = web.get(URL, params) r.raise_for_status() results = r.json()['results'] diff --git a/src/version b/src/version new file mode 100644 index 0000000..ceab6e1 --- /dev/null +++ b/src/version @@ -0,0 +1 @@ +0.1 \ No newline at end of file