Skip to content

Commit 823ffe7

Browse files
authored
Create and edit Quip documents (raycast#855)
* Create and edit Quip documents This set of script commands makes it possible to easily create and add text to different types of Quip documents. They complement the existing Raycast Quip extension, which provides support for searching and viewing Quip documents. With these scripts you can create commands to do one of two actions: - 'create': Create new Quip documents in predefined folders, optionally based on predefined templates (e.g. type 'mnote Meeting title' to automatically create a new document in your "Meeting notes" folder, using an appropriate template). You can define as many different "create" actions as you need. - 'add': Add text to an existing Quip document, optionally formatted as list items (e.g. type 'todo Update the documentation' to add a todo item to your "Action items" document). You can define as many "add" actions as you need. See the README file for full details. * Added chezmoi template and instructions Second config template which can be used with chezmoi to populate secrets in the config file from KeePassXC entries.
1 parent 8b4b503 commit 823ffe7

13 files changed

+1428
-0
lines changed

commands/apps/quip/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
tmp/
3+
quip_config.ini
4+
quip-new-*.py
5+
__pycache__

commands/apps/quip/README.org

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#+title: Raycast script commands for Quip
2+
3+
This set of script commands makes it possible to easily create and add text to different types of Quip documents. They complement the existing Raycast [[https://www.raycast.com/justin0u0/quip][Quip extension]], which provides support for searching and viewing Quip documents.
4+
5+
With these scripts you can create commands to do one of two actions:
6+
7+
- =create=: Create new Quip documents in predefined folders, optionally based on predefined templates (e.g. type =mnote Meeting title= to automatically create a new document in your "Meeting notes" folder, using an appropriate template). You can define as many different "create" actions as you need.
8+
- =add=: Add text to an existing Quip document, optionally formatted as list items (e.g. type =todo Update the documentation= to add a todo item to your "Action items" document). You can define as many "add" actions as you need.
9+
10+
You can customize the behavior during and after these actions, including the following:
11+
- Open the created/updated document automatically (and whether to use the Quip app or the web browser for this)
12+
- Copy the URL of the created/updated document to the clipboard.
13+
- Prepend the current date to the title of newly created documents or added text.
14+
- Use different templates for each type of document created.
15+
- The Quip folder in which to store each type of created document.
16+
- Produce notifications after each command finishes execution.
17+
18+
* Configuration and use
19+
20+
To get set up, do the following:
21+
22+
1. Check out this repository and add the =quip= directory as a Script Directory in the Raycast preferences:
23+
[[file:images/raycast-script-directory-prefs.png]]
24+
2. Copy =quip_config.template.ini= to =quip_config.ini= and customize it to your needs. You need to set at least the following values:
25+
- =APIToken= to your Quip personal API token. You can get one at https://quip.com/api/personal-token (the URL may be different if you are using a Quip Enterprise instance with a custom domain).
26+
- If you are using a custom Quip domain, modify =BaseURL= and =APIURL= accordingly.
27+
- Configure the actions you want. See the examples in the template for details on how to configure them.
28+
- *Note:* if you want to populate Quip secrets and other values from a password manager, see =quip_config.chezmoi.template.ini= for an example which inserts those values from entries kept in KeePassXC. Instructions are at the top of the file.
29+
3. Once your configuration is complete, run from Raycast the "Set up Quip commands" command. This will ask you for confirmation and then generate scripts corresponding to your configuration, which will be loaded automatically by Raycast.
30+
[[file:images/raycast-setup-quip-commands.png]]
31+
[[file:images/raycast-generate-quip-commands-output.png]]
32+
4. You can now use the generated commands to create or add text to Quip documents. You can of course configure aliases or hotkeys for the commands you need the most in the Raycast Script Commands settings.
33+
[[file:images/raycast-quip-commands.png]]
34+
[[file:images/raycast-script-command-settings.png]]
35+
5. Note that you can also run the generated scripts from the command line to execute the corresponding actions. For example:
36+
#+begin_src shell
37+
./quip-new-note.py "New note title"
38+
#+end_src
39+
6. If you need to update or modify your config (e.g. to add or remove actions), make sure you rerun the "Set up Quip commands" command afterwards, to ensure the scripts are kept up to date.
2.97 MB
Loading
2.89 MB
Loading
796 KB
Loading
795 KB
Loading
2.87 MB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python3
2+
3+
# Required parameters:
4+
# @raycast.schemaVersion 1
5+
# @raycast.title {{commandtitle}}
6+
# @raycast.mode compact
7+
8+
# Optional parameters:
9+
# @raycast.icon /Applications/Quip.app/Contents/Resources/AppIcon.icns
10+
# @raycast.argument1 { "type": "text", "placeholder": "{{commandargplaceholder}}", "optional": {{opendocifemptyarg}} }
11+
# @raycast.packageName Quip utilities
12+
13+
# Documentation:
14+
# @raycast.description Configure your Quip API token and other defaults in quip_config.ini
15+
# @raycast.author zzamboni
16+
# @raycast.authorURL https://raycast.com/zzamboni
17+
18+
import sys
19+
import re
20+
import quip_utils
21+
22+
# Determine the document type to create from the script filename.
23+
match = re.search('quip-new-(.+)\.py', sys.argv[0])
24+
if match:
25+
doc_type = match.group(1)
26+
if len(sys.argv) > 1:
27+
arg = sys.argv[1]
28+
else:
29+
arg = None
30+
quip_utils.quip_new_doc(doc_type, arg)
31+
else:
32+
quip_utils.fail(f"Error: Could not determine document type to use - incorrect script name.")

0 commit comments

Comments
 (0)