diff --git a/main.go b/main.go index 69ab774..5535cf4 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ var ( // script options (populated by kingpin application) searchURL *url.URL maxResults int + query string // workflow wf *aw.Workflow @@ -38,6 +39,10 @@ func init() { filterWebsitesCmd = app.Command("websites", "filters websites").Alias("fl") + for _, cmd := range []*kingpin.CmdClause{filterWebsitesCmd} { + cmd.Flag("query", "search query").Short('q').StringVar(&query) + } + // list action commands app.DefaultEnvars() } @@ -50,10 +55,11 @@ func filterWebsites(links map[string]string) { var re = regexp.MustCompile(`.: `) for key, value := range links { - wf.NewItem(key).Valid(true).Var("URL", value).Var("ARG", re.ReplaceAllString(key, ``)).SortKey(key) + wf.NewItem(key).Valid(true).Var("URL", value).Var("ARG", re.ReplaceAllString(key, ``)) log.Println(key) log.Println(value) } + wf.Filter(query) wf.SendFeedback() } diff --git a/readme.md b/readme.md index b626892..92e6af6 100644 --- a/readme.md +++ b/readme.md @@ -25,6 +25,7 @@ Each search has a prefix to signify the theme or scope of the search. For exampl | g: | search GitHub | | s: | search stack exchange sites | | f: | search forums | +| t: | search Google Translate | | w: | search ordinary websites (none of the above) | diff --git a/workflow/alfred-web-searches b/workflow/alfred-web-searches index 72df071..050e99c 100755 Binary files a/workflow/alfred-web-searches and b/workflow/alfred-web-searches differ diff --git a/workflow/info.plist b/workflow/info.plist index c370aa9..9f6ee23 100644 --- a/workflow/info.plist +++ b/workflow/info.plist @@ -8,6 +8,19 @@ mine connections + 0B629748-2068-4345-BA43-5772F37C3013 + + + destinationuid + 64553C43-17D7-47DB-9683-2EF6A128F514 + modifiers + 0 + modifiersubtext + + vitoclose + + + 12976163-3ECA-4242-AA2F-049100EE88ED @@ -46,6 +59,16 @@ vitoclose + + destinationuid + 0B629748-2068-4345-BA43-5772F37C3013 + modifiers + 262144 + modifiersubtext + + vitoclose + + C94BCEFA-1DEE-4E57-AADB-25226571390C @@ -97,6 +120,25 @@ version 1 + + config + + argumenttype + 0 + subtext + + text + search {var:ARG} for {query} + withspace + + + type + alfred.workflow.input.keyword + uid + 9B873AF1-35BA-49E8-B24D-12F7FABB9DDF + version + 1 + config @@ -105,9 +147,7 @@ escaping 102 script - query=$1 - -echo -n ${URL/tester/$query} + echo -n ${URL/tester/$1} scriptargtype 1 scriptfile @@ -141,25 +181,6 @@ echo -n ${URL/tester/$query} version 1 - - config - - argumenttype - 0 - subtext - - text - search {var:ARG} for {query} - withspace - - - type - alfred.workflow.input.keyword - uid - 9B873AF1-35BA-49E8-B24D-12F7FABB9DDF - version - 1 - config @@ -182,7 +203,7 @@ echo -n ${URL/tester/$query} runningsubtext script - ./alfred-web-searches websites + ./alfred-web-searches websites -q "$1" scriptargtype 1 scriptfile @@ -234,11 +255,60 @@ echo -n ${URL/tester/$query} version 2 + + config + + browser + com.google.Chrome + spaces + + url + {query} + utf8 + + + type + alfred.workflow.action.openurl + uid + 64553C43-17D7-47DB-9683-2EF6A128F514 + version + 1 + + + config + + concurrently + + escaping + 102 + script + echo -n ${URL/tester/$1} + scriptargtype + 1 + scriptfile + + type + 0 + + type + alfred.workflow.action.script + uid + 0B629748-2068-4345-BA43-5772F37C3013 + version + 2 + readme uidata + 0B629748-2068-4345-BA43-5772F37C3013 + + xpos + 610 + ypos + 180 + 12976163-3ECA-4242-AA2F-049100EE88ED xpos @@ -253,6 +323,13 @@ echo -n ${URL/tester/$query} ypos 40 + 64553C43-17D7-47DB-9683-2EF6A128F514 + + xpos + 780 + ypos + 180 + 9B873AF1-35BA-49E8-B24D-12F7FABB9DDF xpos @@ -263,14 +340,14 @@ echo -n ${URL/tester/$query} A16C9145-6939-48CC-8054-EF9FD220B697 xpos - 740 + 800 ypos 40 C94BCEFA-1DEE-4E57-AADB-25226571390C xpos - 570 + 610 ypos 40 diff --git a/workflow/websites.csv b/workflow/websites.csv index eb7cbc4..06b2b6a 100644 --- a/workflow/websites.csv +++ b/workflow/websites.csv @@ -102,7 +102,171 @@ s: android enthusiasts, http://android.stackexchange.com/search?q=tester s: arqade, http://gaming.stackexchange.com/search?q=tester s: ask different, http://apple.stackexchange.com/search?q=tester s: ask ubuntu, http://askubuntu.com/search?q=tester - - - - +s: biology, http://biology.stackexchange.com/search?q=tester +s: bitcoin, http://bitcoin.stackexchange.com/search?q=tester +s: buddhism, http://buddhism.stackexchange.com/search?q=tester +s: chemistry, http://chemistry.stackexchange.com/search?q=tester +s: cognitive sciences, http://cogsci.stackexchange.com/search?q=tester +s: computational science, http://scicomp.stackexchange.com/search?q=tester +s: computer science, http://cs.stackexchange.com/search?q=tester +s: cross validated, http://stats.stackexchange.com/search?q=tester +s: database administrators, http://dba.stackexchange.com/search?q=tester +s: electrical engineering, http://electronics.stackexchange.com/search?q=tester +s: english language, http://english.stackexchange.com/search?q=tester +s: freelancing, http://freelancing.stackexchange.com/search?q=tester +s: game development, http://gamedev.stackexchange.com/search?q=tester +s: graphic design, http://graphicdesign.stackexchange.com/search?q=tester +s: information security, http://security.stackexchange.com/search?q=tester +s: history, http://history.stackexchange.com/search?q=tester +s: home improvement, http://diy.stackexchange.com/search?q=tester +s: math overflow, http://mathoverflow.net/search?q=tester +s: mathematica, http://mathematica.stackexchange.com/search?q=tester +s: mathematical educators, http://matheducators.stackexchange.com/search?q=tester +s: mathematics, http://math.stackexchange.com/search?q=tester +s: meta, http://meta.stackexchange.com/search?q=tester +s: movies & tv, http://movies.stackexchange.com/search?q=tester +s: network engineering stack, http://networkengineering.stackexchange.com/search?q=tester +s: open data, http://opendata.stackexchange.com/search?q=tester +s: personal finance, http://money.stackexchange.com/search?q=tester +s: personal productivity, http://productivity.stackexchange.com/search?q=tester+ +s: pets, http://pets.stackexchange.com/search?q=tester +s: philosohy, http://philosophy.stackexchange.com/search?q=tester +s: photography, http://photo.stackexchange.com/search?q=tester +s: physics, http://physics.stackexchange.com/search?q=tester +s: programmers, http://programmers.stackexchange.com/search?q=tester +s: project management, http://pm.stackexchange.com/search?q=tester +s: raspberry, http://raspberrypi.stackexchange.com/search?q=tester +s: reverse engineering, http://reverseengineering.stackexchange.com/search?q=tester +s: robotics, http://robotics.stackexchange.com/search?q=tester +s: role playing games, http://rpg.stackexchange.com/search?q=tester +s: salesforce, http://salesforce.stackexchange.com/search?q=tester +s: scifi & fantasy, http://scifi.stackexchange.com/search?q=tester +s: serverfault, http://serverfault.com/search?q=tester +s: sharepoint, http://sharepoint.stackexchange.com/search?q=tester +s: signal processing, http://dsp.stackexchange.com/search?q=tester +s: skeptics, http://skeptics.stackexchange.com/search?q=tester +s: software recommendations, http://softwarerecs.stackexchange.com/search?q=tester +s: sound design, http://sound.stackexchange.com/search?q=tester +s: space exploration, http://space.stackexchange.com/search?q=tester +s: stack overflow, http://stackoverflow.com/search?q=tester +s: stack python, http://stackoverflow.com/search?q=python+tester +s: super user, http://superuser.com/search?q=tester +s: theoretical compsi, http://cstheory.stackexchange.com/search?q=tester +s: tor stack, http://tor.stackexchange.com/search?q=tester +s: travel, http://travel.stackexchange.com/search?q=tester +s: unix & linux, http://unix.stackexchange.com/search?q=tester +s: user experience, http://ux.stackexchange.com/search?q=tester +s: web apps, http://webapps.stackexchange.com/search?q=tester +s: web masters, http://webmasters.stackexchange.com/search?q=tester +s: workplace, http://workplace.stackexchange.com/search?q=tester +s: writers, http://writers.stackexchange.com/search?q=tester +d: search os status, https://www.osstatus.com/search/results?platform=all&framework=all&search=tester +t: translate to english, https://translate.google.com/#auto/en/tester +t: translate to dutch, https://translate.google.com/#auto/nl/tester +t: translate to russian, https://translate.google.com/#auto/ru/tester +t: translate to spanish, https://translate.google.com/#auto/es/tester +w: 8tracks, http://8tracks.com/explore/tester +w: abbreviation terms, http://www.abbreviations.com/abbreviation/tester +w: yandex, https://www.yandex.com/search/?msid=1484233484.98264.22892.24573&text=tester&lr=10466 +w: abbreviations, http://www.abbreviations.com/tester +w: aliexpress, http://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20160518044144&SearchText=tester +w: alternativeTo, http://alternativeto.net/browse/search?q=tester +w: angellist, https://angel.co/search?q=tester +w: appshopper, http://appshopper.com/search?search=tester +w: better explained, http://betterexplained.com/?s=tester +w: champion.gg, http://champion.gg/champion/tester +w: codeforces, http://codeforces.com/search?by=&query=binary +w: coursera courses, https://www.coursera.org/courses?search=tester +w: css tricks, https://css-tricks.com/search-results/?q=tester +w: documentary heaven, http://documentaryheaven.com/find/?q=tester +w: duckduckgo about, https://duckduckgo.com/?q=tester&ia=about +w: duckduckgo definition, https://duckduckgo.com/?q=tester&ia=definition +w: duckduckgo images, https://duckduckgo.com/?q=tester&iax=1&ia=images +w: duckduckgo videos, https://duckduckgo.com/?q=tester&ia=videos +w: edx, https://www.edx.org/course?search_query=tester +w: evolvr, https://www.evolvr.io/search?utf8=✓&query=tester+&commit=Enter +w: examine, http://examine.com/search/?q=tester&homepage=1 +w: extra torrent, http://extratorrent.cc/search/?search=tester&new=1&x=0&y=0 +w: facebook messages, https://www.facebook.com/messages/search?action=search-snippet&mquery=tester +w: go search, http://go-search.org/search?q=tester +w: google search for past month, https://www.google.com/search?q=tester&tbs=qdr:m +w: google search for past week, https://www.google.com/search?q=tester&tbs=qdr:w +w: instagram tags, https://instagram.com/explore/tags/tester/ +w: open subreddit, https://www.reddit.com/r/tester +w: twitter user, https://twitter.com/tester +w: merriam webster dictionary, http://www.merriam-webster.com/dictionary/tester +w: github, https://github.com/search?utf8=%E2%9C%93&q=tester&type=Repositories&ref=searchresults +w: golang, https://golang.org/search?q=tester +w: goodreads quotes, https://www.goodreads.com/quotes/search?utf8=✓&q=tester&commit=Search +w: google drive, https://drive.google.com/drive/search?q=tester +w: google for past 24 hours, https://www.google.com/search?q=tester&tbs=qdr:d +w: google for pdfs, https://www.google.com/#q=filetype:pdf+tester +w: google groups, http://groups.google.com/groups?q=tester +w: google scholar, https://scholar.google.com/scholar?hl=en&q=tester&btnG=&as_sdt=1%2C44&as_sdtp= +w: google scholar past 2015, https://scholar.google.com/scholar?as_ylo=2015&q=tester&hl=en&as_sdt=0,44 +w: google verbatim, https://www.google.com/search?q=tester&tbs=li:1 +w: grouevee, https://www.grouvee.com/search/?q=tester +w: habrahabr, http://habrahabr.ru/search/?q=tester +w: hacker news, https://hn.algolia.com/?query=tester&sort=byPopularity&prefix&page=0&dateRange=all&type=story +w: how stuff works, http://www.howstuffworks.com/search.php?terms=tester +w: icon store, http://iconstore.co/?s=tester +w: index of a company, https://index.co/company/tester +w: khan academy, https://www.khanacademy.org/search?referer=%2F&page_search_query=tester +w: kinopoisk, http://www.kinopoisk.ru/search/?text=tester +w: libraries.io, https://libraries.io/search?q=tester +w: lifehacker, http://lifehacker.com/search?q=tester +w: macosx hints, http://www.macosxhints.com/search.php?query=tester&type=stories&mode=search&keyType=all +w: mac rumours, http://forums.macrumors.com/search/2213886/?q=tester&o=date +w: macupdate, https://www.macupdate.com/find/mac/tester +w: math world, http://mathworld.wolfram.com/search/?query=tester&x=0&y=0 +w: metacademy, https://www.metacademy.org/search?q=tester +d: meteor packages, https://atmospherejs.com/?q=tester +w: mit open courseware, http://search.mit.edu/search?site=ocw&client=mit&getfields=*&output=xml_no_dtd&proxystylesheet=http%3A%2F%2Focw.mit.edu%2Fsearch%2Fgoogle-ocw.xsl&requiredfields=WT%252Ecg_s%3ACourse+Home%7CWT%252Ecg_s%3AResource+Home§ionlimit=WT%252Ecg_s%3ACourse+Home%7CWT%252Ecg_s%3AResource+Home&as_dt=i&oe=utf-8&departmentName=web&filter=0&courseName=&q=tester&btnG.x=0&btnG.y=0 +w: npms, https://npms.io/search?term=tester +w: nutrition facts, http://nutritionfacts.org/?fwp_search=tester +w: opgg, http://euw.op.gg/summoner/userName=tester +w: patrick jmt, http://patrickjmt.com/?s=tester +w: piratebay, https://pirateproxy.la/search/tester/0/99/0 +w: pixabay, https://pixabay.com/en/photos/?q=tester&image_type=&cat=&min_width=&min_height= +w: pocket, https://www.getpocket.com/explore/tester +w: proof wiki, https://proofwiki.org/w/index.php?title=Special%3ASearch&search=tester +w: proofwiki, https://proofwiki.org/w/index.php?search=tester&title=Special%3ASearch&go=Go +w: psychonaut wiki, https://psychonautwiki.org/wiki/tester +w: quizlet, https://quizlet.com/subject/tester/ +w: reddit for past month, https://www.reddit.com/search?q=tester&t=month +w: reddit for past week, https://www.reddit.com/search?q=tester&t=week +w: reddit for past year, https://www.reddit.com/search?q=tester&t=year +w: reddit for the past day, https://www.reddit.com/search?q=tester&t=day +w: reddit for the past hour, https://www.reddit.com/search?q=tester&t=hour +w: ruby gems, https://rubygems.org/search?utf8=%E2%9C%93&query=tester +w: rutracker, http://rutracker.org/forum/tracker.php?nm=tester +w: simple wikipedia, https://simple.wikipedia.org/w/index.php?search=tester&title=Special%3ASearch&go=Go +w: slashdot, http://slashdot.org/?fhfilter=tester +w: stackshare, http://stackshare.io/search/q=tester +w: stanford searchworks, http://searchworks.stanford.edu/?q=tester&search_field=search +w: student room, http://www.thestudentroom.co.uk/search.php?query=tester +w: stylish, https://userstyles.org/styles/browse?search_terms=tester +w: symlab, https://www.symbolab.com/solver/step-by-step/tester +w: syntax, https://syntaxdb.com/reference/search?utf8=✓&search=tester +w: ted talks, http://www.ted.com/search?q=tester +w: terminal commands, http://www.openbsd.org/cgi-bin/man.cgi?query=tester +w: thesaurus, http://www.thesaurus.com/browse/tester?s=t +w: trakt, https://trakt.tv/search?utf8=✓&query=tester +w: tumblr, https://www.tumblr.com/search/tester +w: twitter live feed, https://twitter.com/search?f=tweets&vertical=default&q=tester&src=typd +w: twitter videos, https://twitter.com/search?f=videos&vertical=default&q=tester&src=typd +w: udemy, https://www.udemy.com/courses/search/?q=tester +w: ui talks, http://talks.ui-patterns.com/search?utf8=✓&q=tester +w: ultimate guitar, http://www.ultimate-guitar.com/search.php?search_type=title&value=tester +w: unsplash, https://unsplash.com/search/photos/tester +w: urban dictionary, http://www.urbandictionary.com/define.php?term=tester +w: vim awesome, http://vimawesome.com/?q=tester +w: vim wiki, http://vim.wikia.com/wiki/Special:Search?search=tester&fulltext=Search +w: vk, https://vk.com/search?c[q]=tester&c[section]=auto +w: vk music, http://vk.com/audios196314313?q=tester +w: vk people, https://vk.com/search?c%5Bname%5D=1&c%5Bq%5D=tester&c%5Bsection%5D=people +w: whois, http://whois.domaintools.com/tester +w: wikihow, http://www.wikihow.com/Special:LSearch?search=tester +w: wolfram alpha derive, http://www.wolframalpha.com/input/?i=derive+tester +w: wolfram alpha integrate, http://www.wolframalpha.com/input/?i=integrate+tester +w: wolfram alpha solve, http://www.wolframalpha.com/input/?i=solve+tester \ No newline at end of file