forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtldr.sh
executable file
·32 lines (26 loc) · 855 Bytes
/
tldr.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
29
30
31
32
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Print TLDR doc
# @raycast.mode fullOutput
# Optional parameters:
# @raycast.icon 🤖
# @raycast.argument1 { "type": "text", "placeholder": "Command" }
# @raycast.argument2 { "type": "text", "placeholder": "OS [linux, osx, sunos, windows]", "optional": true }
# @raycast.packageName Developer Utils
# @Documentation:
# @raycast.description Print the tldr documentation for a command
# @raycast.author Achille Lacoin
# @raycast.authorURL https://github.com/pomdtr
if ! command -v tldr &>/dev/null; then
echo "tldr CLI is not installed."
echo "Installation instructions: https://dbrgn.github.io/tealdeer/installing.html"
exit 1
fi
command=$1
os=$2
if test -z "$os"; then
tldr "$command" --color always
else
tldr "$command" --os "$os" --color always
fi