forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquip-new.template.py
executable file
·32 lines (27 loc) · 996 Bytes
/
quip-new.template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title {{commandtitle}}
# @raycast.mode compact
# Optional parameters:
# @raycast.icon /Applications/Quip.app/Contents/Resources/AppIcon.icns
# @raycast.argument1 { "type": "text", "placeholder": "{{commandargplaceholder}}", "optional": {{opendocifemptyarg}} }
# @raycast.packageName Quip utilities
# Documentation:
# @raycast.description Configure your Quip API token and other defaults in quip_config.ini
# @raycast.author zzamboni
# @raycast.authorURL https://raycast.com/zzamboni
import sys
import re
import quip_utils
# Determine the document type to create from the script filename.
match = re.search('quip-new-(.+)\.py', sys.argv[0])
if match:
doc_type = match.group(1)
if len(sys.argv) > 1:
arg = sys.argv[1]
else:
arg = None
quip_utils.quip_new_doc(doc_type, arg)
else:
quip_utils.fail(f"Error: Could not determine document type to use - incorrect script name.")