Package: alfred-workflow-tddschn
Note: this is a fork of the amazinghttps://github.com/deanishe/alfred-workflowand has some differences.alfred-workflow-tddschnA helper library in Python for authors of workflows forAlfred 3 and 4.Supports Alfred 3 and Alfred 4 on macOS 10.7+ (Python 3.7+).alfred-workflow-tddschn takes the grunt work out of writing a workflow by giving you the tools to create a fast and featureful Alfred workflow from an API, application or library in minutes.Always supports all current Alfred features.FeaturesAuto-saved settings API for your workflowSuper-simple data caching with expiryFuzzy filtering (with smart diacritic folding)Keychain support for secure storage of passwords, API keys etc.Background tasks to keep your workflow responsiveSimple generation of Alfred JSON feedbackFull support of Alfred's AppleScript/JXA APICatches and logs workflow errors for easier development and support"Magic" arguments to help development/debuggingUnicode supportPre-configured loggingAutomatically check for workflow updates via GitHub releasesPost notifications via Notification CenterAlfred 4+ featuresAdvanced modifiersAlfred 4-only updates (won't break older Alfred installs)Contentsalfred-workflow-tddschnFeaturesAlfred 4+ featuresContentsInstallationWith pipFrom sourceUsageWorkflow script skeletonExamplesKeychain accessDocumentationDash docsetLicensing, thanksContributingAdding a workflow to the listBug reports, pull requestsContributorsWorkflows using alfred-workflow-tddschnInstallationNote: If you're new to Alfred workflows, check outthe tutorialin the docs.With pipYou can install alfred-workflow-tddschn directly into your workflow with:# from your workflow directorypipinstall--target=.alfred-workflow-tddschnYou can install any other library available on theCheese Shopthe same way. See thepip documentationfor more information.It is highly advisable to bundle all your workflow's dependencies with your workflow in this way. That way, it will "just work".From sourceDownload thealfred-workflow-X.X.X.zipfrom theGitHub releases page.Extract the ZIP archive and place theworkflowdirectory in the root folder of your workflow (whereinfo.plistis).Your workflow should look something like this:Your Workflow/
    info.plist
    icon.png
    workflow/
        __init__.py
        background.py
        notify.py
        Notify.tgz
        update.py
        version
        workflow.py
    yourscript.py
    etc.Alternatively, you can clone/download the alfred-workflow-tddschnrepositoryand copy theworkflowsubdirectory to your workflow's root directory.UsageA few examples of how to use alfred-workflow-tddschn.Workflow script skeletonSet up your workflow scripts as follows (if you wish to use the built-in error handling orsys.pathmodification):#!/usr/bin/python# encoding: utf-8importsys# Workflow3 supports Alfred 3's new features. The `Workflow` class# is also compatible with Alfred 2.fromworkflowimportWorkflow3defmain(wf):# The Workflow3 instance will be passed to the function# you call from `Workflow3.run`.# Not super useful, as the `wf` object created in# the `if __name__ ...` clause below is global...## Your imports go here if you want to catch import errors, which# is not a bad idea, or if the modules/packages are in a directory# added via `Workflow3(libraries=...)`importsomemoduleimportanothermodule# Get args from Workflow3, already in normalized Unicode.# This is also necessary for "magic" arguments to work.args=wf.args# Do stuff here ...# Add an item to Alfred feedbackwf.add_item(u'Item title',u'Item subtitle')# Send output to Alfred. You can only call this once.# Well, you *can* call it multiple times, but subsequent calls# are ignored (otherwise the JSON sent to Alfred would be invalid).wf.send_feedback()if__name__=='__main__':# Create a global `Workflow3` objectwf=Workflow3()# Call your entry function via `Workflow3.run()` to enable its# helper functions, like exception catching, ARGV normalization,# magic arguments etc.sys.exit(wf.run(main))ExamplesCache data for 30 seconds:defget_web_data():importjsonfromurllibimportrequestwithrequest.urlopen('http://www.example.com')asf:data=f.read().decode('utf-8')returnjson.loads(data)defmain(wf):# Save data from `get_web_data` for 30 seconds under# the key ``example``data=wf.cached_data('example',get_web_data,max_age=30)fordatumindata:wf.add_item(datum['title'],datum['author'])wf.send_feedback()Keychain accessSave password:wf=Workflow()wf.save_password('name of account','password1lolz')Retrieve password:wf=Workflow()wf.get_password('name of account')DocumentationThe full documentation, including API docs and a tutorial, can be found atdeanishe.net.Dash docsetThe documentation is also available as aDash docset.Licensing, thanksThe code and the documentation are released under the MIT andCreative Commons Attribution-NonCommercialLicenses respectively. SeeLicense.txtfor details.The documentation was generated usingSphinxand a modified version of theAlabastertheme bybitprophet.Many of the cooler ideas in alfred-workflow-tddschn were inspired byAlfred2-Ruby-Templateby Zhaocai.The Keychain parser was based onPython-Keyringby Jason R. Coombs.ContributingAdding a workflow to the listIf you want to add a workflow to thelist of workflows using alfred-workflow-tddschn,don't add it to the docs!The list is machine-generated fromPackal.organd thelibrary_workflows.tsvfile. If your workflow is available onPackal, it will be added on the next update. If not, please add it tolibrary_workflows.tsv, and submit a corresponding pull request.The list is not auto-updated, so if you've released a workflow and are keen to see it in this list, pleaseopen an issueasking me to update the list.Bug reports, pull requestsPlease seethe documentation.ContributorsDean JacksonStephen MargheimFabio NiephausOwen MinWorkflows using alfred-workflow-tddschnHere is a listof some of the many workflows based on alfred-workflow-tddschn.