forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch-script-command.sh
executable file
·37 lines (30 loc) · 1.02 KB
/
search-script-command.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
33
34
35
36
37
#!/bin/bash
# Dependency: This script requires `swift` installed.
# Install via https://swift.org/download/
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Search Script Command
# @raycast.mode fullOutput
# @raycast.packageName Searches
#
# Optional parameters:
# @raycast.author Thiago Holanda
# @raycast.authorURL https://twitter.com/tholanda
# @raycast.icon 🔎
# @raycast.description Search for Script Commands available in the Raycast repository
# @raycast.argument1 { "type": "text", "placeholder": "Query"}
# Files related to this Script Command:
# - search-script-command.sh (this file)
# - search-script-command.swift
# - search-script-command (this binary file will be generated by swiftc)
if ! command -v swiftc &> /dev/null; then
echo "Swift is required (https://swift.org/download).";
exit 1;
fi
filename=${0##*/}
basename=${filename%.*}
swift_filename="$basename.swift"
if [ ! -f $basename ] && [ -f $swift_filename ]; then
$(swiftc $swift_filename -emit-executable -o $basename)
fi
./$basename "$1"