Skip to content

Commit 3bdec75

Browse files
committed
Support all StackExchange sites with advanced search
1 parent dc177c4 commit 3bdec75

25 files changed

+2974
-1002
lines changed

.gitignore

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,4 @@
1-
2-
# Created by https://www.gitignore.io/api/python,vim,sublimetext
3-
4-
### Python ###
5-
# Byte-compiled / optimized / DLL files
61
__pycache__/
72
*.py[cod]
83
*$py.class
9-
10-
# C extensions
11-
*.so
12-
13-
# Distribution / packaging
14-
.Python
15-
env/
16-
build/
17-
develop-eggs/
18-
dist/
19-
downloads/
20-
eggs/
21-
.eggs/
22-
lib/
23-
lib64/
24-
parts/
25-
sdist/
26-
var/
27-
*.egg-info/
28-
.installed.cfg
29-
*.egg
30-
31-
# PyInstaller
32-
# Usually these files are written by a python script from a template
33-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34-
*.manifest
35-
*.spec
36-
37-
# Installer logs
38-
pip-log.txt
39-
pip-delete-this-directory.txt
40-
41-
# Unit test / coverage reports
42-
htmlcov/
43-
.tox/
44-
.coverage
45-
.coverage.*
46-
.cache
47-
nosetests.xml
48-
coverage.xml
49-
*,cover
50-
.hypothesis/
51-
52-
# Translations
53-
*.mo
54-
*.pot
55-
56-
# Django stuff:
57-
*.log
58-
local_settings.py
59-
60-
# Flask instance folder
61-
instance/
62-
63-
# Sphinx documentation
64-
docs/_build/
65-
66-
# PyBuilder
67-
target/
68-
69-
# IPython Notebook
70-
.ipynb_checkpoints
71-
72-
# pyenv
73-
.python-version
74-
75-
# dotenv
76-
.env
77-
78-
79-
### Vim ###
80-
# swap
81-
[._]*.s[a-w][a-z]
82-
[._]s[a-w][a-z]
83-
# session
84-
Session.vim
85-
# temporary
86-
.netrwhist
87-
*~
88-
# auto-generated tag files
89-
tags
90-
91-
92-
### SublimeText ###
93-
# cache files for sublime text
94-
*.tmlanguage.cache
95-
*.tmPreferences.cache
96-
*.stTheme.cache
97-
98-
# workspace files are user-specific
99-
*.sublime-workspace
100-
101-
# project files should be checked into the repository, unless a significant
102-
# proportion of contributors will probably not be using SublimeText
103-
# *.sublime-project
104-
105-
# sftp configuration file
106-
sftp-config.json
107-
4+
*.dist-info/

README.md

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,90 @@
11

2-
StackOverflow Search for Alfred
2+
StackExchange Search for Alfred
33
===============================
44

5-
Search for answers on StackOverflow.com from [Alfred 2 & 3][alfred].
5+
Search for answers on StackExchange sites from [Alfred 4+][alfred].
66

77
![](demo.gif "")
88

9+
<!-- MarkdownTOC autolink="true" autoanchor="true" -->
910

11+
- [Download](#download)
12+
- [Usage](#usage)
13+
- [Query syntax](#query-syntax)
14+
- [Results](#results)
15+
- [Adding custom searches](#adding-custom-searches)
16+
- [Licensing, thanks](#licensing-thanks)
17+
18+
<!-- /MarkdownTOC -->
19+
20+
21+
<a id="download"></a>
1022
Download
1123
--------
1224

13-
Get StackOverflow for Alfred from [GitHub][gh-releases] or
14-
[Packal][packal-page].
25+
Get StackExchange for Alfred from [GitHub releases][gh-releases].
1526

1627

28+
<a id="usage"></a>
1729
Usage
1830
-----
1931

32+
The main action (keyword `stack`) shows a list of all StackExchange
33+
sites. Choose one to search it.
34+
35+
There is also a search for StackOverflow.com configured (keyword
36+
`.so`), but it is easy to add searches for your own favourite
37+
StackExchange sites.
38+
39+
- `stack [<query>]` — Choose a StackExchange site to search.
40+
- `` — Select site
41+
- `⌘↩` — Set as default site
42+
- `⌥↩` — Reveal site icon in Finder
43+
- `⌘C` — Copy site ID to clipboard (for adding Script Filters)
2044
- `.so <query>` — Search StackOverflow.com for `<query>`.
2145
See below for syntax.
2246
- `` or ` ⌘+NUM` — Open result in default browser
23-
- `+L` — Show full question title in Alfred's Large Text window
47+
- `⌘L` — Show full question title in Alfred's Large Text window
2448

2549

50+
<a id="query-syntax"></a>
2651
Query syntax
2752
------------
2853

29-
By default, words in `<query>` will be search for in the title of posts. To
30-
specify a tag, prefix it with `.`, e.g. `python` will search for `python` in
31-
the post title, `.python` will search for the tag `python`.
54+
Prefix a word in your `<query>` with `.` (full stop) to indicate that
55+
it's a tag, e.g `requests .python` will search for answers tagged
56+
`python` with the query `requests`.
3257

3358

59+
<a id="results"></a>
3460
Results
3561
-------
3662

37-
Answered questions will be shown first in the list of results (and have a
38-
tick on their icon).
63+
Answered questions will be shown first in the list of results (and have
64+
a green check mark on their icon).
65+
66+
67+
<a id="adding-custom-searches"></a>
68+
Adding custom searches
69+
----------------------
70+
71+
You can easily add your own searches for specific sites by adding your
72+
own Script Filter with the following Script:
73+
74+
```bash
75+
/usr/bin/python so.py search --site <siteid> "$1"
76+
```
77+
78+
The easiest way to do this is to make and edit a copy of the built-in
79+
StackOverflow.com search.
80+
81+
To get a site ID, use the site search (keyword `stack`) and hit `⌘C` on
82+
the desired site to copy its ID to the clipboard.
83+
84+
You can also use `⌥↩` on a site to reveal its icon in Finder.
3985

4086

87+
<a id="licensing-thanks"></a>
4188
Licensing, thanks
4289
-----------------
4390

@@ -51,5 +98,4 @@ It is heavily based on [Alfred-Workflow][alfred-workflow], also
5198
[mit]: http://opensource.org/licenses/MIT
5299
[alfred-workflow]: http://www.deanishe.net/alfred-workflow/
53100
[gh-releases]: https://github.com/deanishe/alfred-stackoverflow/releases
54-
[packal-page]: http://www.packal.org/workflow/stackoverflow-search
55101
[demo]: https://raw.githubusercontent.com/deanishe/alfred-stackoverflow/master/demo.gif
123 KB
Binary file not shown.

StackOverflow-1.3.alfredworkflow

-186 KB
Binary file not shown.

check.acorn

64 KB
Binary file not shown.

check.afdesign

24.3 KB
Binary file not shown.

env.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
# When sourced, creates an Alfred-like environment
3+
4+
# getvar <name> | Read a value from info.plist
5+
getvar() {
6+
local v="$1"
7+
/usr/libexec/PlistBuddy -c "Print :$v" ./src/info.plist
8+
}
9+
10+
export alfred_workflow_bundleid=$( getvar "bundleid" )
11+
export alfred_workflow_version=$( getvar "version" )
12+
export alfred_workflow_name=$( getvar "name" )
13+
14+
# Alfred 4
15+
export alfred_workflow_cache="${HOME}/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/${alfred_workflow_bundleid}"
16+
export alfred_workflow_data="${HOME}/Library/Application Support/Alfred/Workflow Data/${alfred_workflow_bundleid}"
17+
18+
# Alfred 3
19+
if [[ ! -f "$HOME/Library/Preferences/com.runningwithcrayons.Alfred.plist" ]]; then
20+
export alfred_workflow_cache="${HOME}/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/${alfred_workflow_bundleid}"
21+
export alfred_workflow_data="${HOME}/Library/Application Support/Alfred 3/Workflow Data/${alfred_workflow_bundleid}"
22+
export alfred_version="3.8.1"
23+
fi
24+
25+
export cache_max_age=$( getvar "variables:cache_max_age" )
26+
export site_id=$( getvar "variables:site_id" )
27+
export site_name=$( getvar "variables:site_name" )
28+
export result_count=$( getvar "variables:result_count" )
29+
export ignore_meta_sites=$( getvar "variables:ignore_meta_sites" )
6.78 KB
Loading

src/answered.png

-13.3 KB
Binary file not shown.

src/check.png

1.38 KB
Loading

0 commit comments

Comments
 (0)