From a2e7efbc39133ff05bdf00bffa59fd45a27cc4ea Mon Sep 17 00:00:00 2001 From: Alex Zai Date: Sun, 1 Nov 2015 16:47:14 -0800 Subject: [PATCH] (Feat) add versioning --- src/cdn.py | 18 +++++++++++++++--- src/version | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/version 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