forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheat.sh
executable file
·28 lines (23 loc) · 845 Bytes
/
cheat.sh
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
#!/usr/bin/env bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Query cheat.sh
# @raycast.mode fullOutput
# @raycast.packageName Developer Utilities
# Optional parameters:
# @raycast.icon images/cheat.png
# @raycast.argument1 { "type": "text", "placeholder": "Language / Command" }
# @raycast.argument2 { "type": "text", "placeholder": "Question", "optional": true }
# Documentation:
# @raycast.author Jakub Lanski
# @raycast.authorURL https://github.com/jaklan
# @raycast.description Query the cheat.sh service (https://github.com/chubin/cheat.sh). You can change the color style in the script.
language=$1
question=${2// /+}
# Available styles: https://cht.sh/:styles-demo
style="native"
if [ -z "$question" ]; then
curl -s cht.sh/$language?style=$style
else
curl -s cht.sh/$language/$question?style=$style
fi