├── .gitignore ├── icon.png ├── screenshot.png ├── 7B86D057-DA8E-4302-AF17-83B889B48EE2.png ├── .editorconfig ├── composer.json ├── README.md ├── LICENSE ├── tableplus.php └── info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | .DS_Store 3 | composer.lock 4 | *.alfredworkflow -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisrenga/alfred-tableplus/HEAD/icon.png -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisrenga/alfred-tableplus/HEAD/screenshot.png -------------------------------------------------------------------------------- /7B86D057-DA8E-4302-AF17-83B889B48EE2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisrenga/alfred-tableplus/HEAD/7B86D057-DA8E-4302-AF17-83B889B48EE2.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_style = space 7 | indent_size = 4 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{json,yml}] 15 | indent_size = 2 16 | 17 | [composer.json] 18 | indent_size = 2 19 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrisrenga/alfred-tableplus", 3 | "description": "An ultra-fast TablePlus search workflow for Alfred 3.", 4 | "version": "1.1", 5 | "keywords": ["alfred", "alfred-workflow", "TablePlus", "tableplus", "table plus", "mysql", "sql", "redis"], 6 | "homepage": "https://chrisrenga.com", 7 | "support": { 8 | "source": "https://github.com/chrisrenga/alfred-tableplus", 9 | "issues": "https://github.com/chrisrenga/alfred-tableplus/issues" 10 | }, 11 | "license": "MIT", 12 | "require": { 13 | "joetannenbaum/alfred-workflow": "^0.1.0", 14 | "erusev/parsedown": "^1.7", 15 | "akturan/plistparser": "^1.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TablePlus Workflow for Alfred 2 | 3 | An ultra-fast [TablePlus](https://tableplus.io) search workflow for [Alfred 3](https://www.alfredapp.com). 4 | 5 | ![Screenshot](screenshot.png) 6 | 7 | ## Installation 8 | 9 | 1. [Download the latest version](https://github.com/chrisrenga/alfred-tableplus/releases/latest) 10 | 2. Install the workflow by double-clicking the `.alfredworkflow` file 11 | 12 | ## Usage 13 | 14 | Just type `tp` followed by your search query. 15 | 16 | ``` 17 | tp 18 | ``` 19 | 20 | E.g. 21 | ``` 22 | tp local 23 | ``` 24 | 25 | press `` to open the connection. 26 | 27 | ## Credits 28 | Thanks to [huyphams](https://github.com/huyphams) for a great app and prompt reply to my questions. 29 | 30 | Inspired by [tillkruss Alfred Laravel docs](https://github.com/tillkruss/alfred-laravel-docs) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Chris Renga 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tableplus.php: -------------------------------------------------------------------------------- 1 | plistToArray($basepath . '/Connections.plist'); 30 | $groups = $plist->plistToArray($basepath . '/ConnectionGroups.plist'); 31 | 32 | $results = empty($query) ? $connections : array_filter($connections, function ($connection) use ($query) { 33 | return strpos(strtolower($connection['ConnectionName']), strtolower($query)) !== false; 34 | }); 35 | 36 | $urls = []; 37 | 38 | foreach ($results as $result) { 39 | $connection = $result; 40 | 41 | $groupKey = array_search($connection['GroupID'], array_column($groups, 'ID')); 42 | $group = $groups[$groupKey]; 43 | 44 | $url = 'tableplus://?id=' . sprintf($connection['ID']); 45 | 46 | if (in_array($url, $urls)) { 47 | continue; 48 | } 49 | 50 | $urls[] = $url; 51 | 52 | $title = "{$connection['ConnectionName']} » {$connection['Driver']}"; 53 | 54 | $text = "{$group['Name']} » {$connection['Enviroment']}"; 55 | 56 | $title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8')); 57 | 58 | $text = $parsedown->line($text); 59 | $text = strip_tags(html_entity_decode($text, ENT_QUOTES, 'UTF-8')); 60 | 61 | $workflow->result() 62 | ->uid($connection['ID']) 63 | ->title($title) 64 | ->autocomplete($title) 65 | ->subtitle($text) 66 | ->arg($url) 67 | ->quicklookurl($url) 68 | ->valid(true); 69 | } 70 | 71 | echo $workflow->output(); 72 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.chrisrenga.tableplus 7 | connections 8 | 9 | 7B86D057-DA8E-4302-AF17-83B889B48EE2 10 | 11 | 12 | destinationuid 13 | C09D0997-D164-4789-91EB-18A12DAF4126 14 | modifiers 15 | 0 16 | modifiersubtext 17 | 18 | vitoclose 19 | 20 | 21 | 22 | 23 | createdby 24 | Chris Renga 25 | description 26 | An ultra-fast TablePlus connection search workflow 27 | disabled 28 | 29 | name 30 | TablePlus 31 | objects 32 | 33 | 34 | config 35 | 36 | concurrently 37 | 38 | escaping 39 | 102 40 | script 41 | open $1 42 | scriptargtype 43 | 1 44 | scriptfile 45 | 46 | type 47 | 0 48 | 49 | type 50 | alfred.workflow.action.script 51 | uid 52 | C09D0997-D164-4789-91EB-18A12DAF4126 53 | version 54 | 2 55 | 56 | 57 | config 58 | 59 | alfredfiltersresults 60 | 61 | alfredfiltersresultsmatchmode 62 | 0 63 | argumenttreatemptyqueryasnil 64 | 65 | argumenttrimmode 66 | 0 67 | argumenttype 68 | 1 69 | escaping 70 | 127 71 | keyword 72 | tp 73 | queuedelaycustom 74 | 3 75 | queuedelayimmediatelyinitially 76 | 77 | queuedelaymode 78 | 0 79 | queuemode 80 | 1 81 | runningsubtext 82 | Searching connections for "{query}"... 83 | script 84 | if [ -f "/opt/homebrew/bin/php" ]; then 85 | /opt/homebrew/bin/php tableplus.php "$1" 86 | elif [ -f "/usr/local/bin/php" ]; then 87 | /usr/local/bin/php tableplus.php "$1" 88 | elif [ -f "/usr/bin/php" ]; then 89 | /usr/bin/php tableplus.php "$1" 90 | fi 91 | scriptargtype 92 | 1 93 | scriptfile 94 | 95 | subtext 96 | Search the TablePlus connections... 97 | title 98 | Table Plus 99 | type 100 | 0 101 | withspace 102 | 103 | 104 | type 105 | alfred.workflow.input.scriptfilter 106 | uid 107 | 7B86D057-DA8E-4302-AF17-83B889B48EE2 108 | version 109 | 3 110 | 111 | 112 | readme 113 | 114 | uidata 115 | 116 | 7B86D057-DA8E-4302-AF17-83B889B48EE2 117 | 118 | xpos 119 | 200 120 | ypos 121 | 90 122 | 123 | C09D0997-D164-4789-91EB-18A12DAF4126 124 | 125 | xpos 126 | 440 127 | ypos 128 | 90 129 | 130 | 131 | variablesdontexport 132 | 133 | version 134 | 1.1 135 | webaddress 136 | https://www.chrisrenga.com 137 | 138 | 139 | --------------------------------------------------------------------------------