Skip to content

Commit d15d2c7

Browse files
authored
Run a Shell Command using Hyper (raycast#682)
* Create hyper-run-shell-command.sh and hyper.png * Titlecase for the placeholder and a lower image resolution * Update commands/apps/hyper/hyper-run-shell-command.applescript * Update commands/apps/hyper/hyper-run-shell-command.applescript * Update hyper-run-shell-command.applescript
1 parent f87b29d commit d15d2c7

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/osascript
2+
3+
# Note: Hyper required
4+
# Install via Hyper.is: https://hyper.is/
5+
6+
# Dependency: This script requires `hyperalfred` (https://github.com/gjuchault/hyperalfred)
7+
# Install via Hyper: `hyper i hyperalfred`
8+
9+
# Required parameters:
10+
# @raycast.schemaVersion 1
11+
# @raycast.title Run Shell Command
12+
# @raycast.mode silent
13+
# @raycast.packageName Hyper
14+
15+
# Optional parameters:
16+
# @raycast.icon images/hyper.png
17+
# @raycast.argument1 { "type": "text", "placeholder": "Command" }
18+
19+
# Documentation:
20+
# @raycast.description Run a terminal using Hyper
21+
# @raycast.author Eliot Hertenstein
22+
# @raycast.authorURL https://github.com/eIiot
23+
24+
on run argv
25+
write_to_file( (item 1 of argv) , "./.hyper_plugins/hyperalfred.txt", false)
26+
try
27+
tell application "Hyper" to activate
28+
on error e
29+
log "Hyper is required (https://hyper.is)"
30+
-- return false
31+
end try
32+
end run
33+
34+
on write_to_file(this_data, target_file, append_data)
35+
try
36+
tell application "System Events" to exists file target_file
37+
if not the result then do shell script "> " & quoted form of target_file
38+
set the open_target_file to open for access target_file with write permission
39+
if append_data is false then set eof of the open_target_file to 0
40+
write this_data to the open_target_file starting at eof
41+
close access the open_target_file
42+
return true
43+
on error e
44+
try
45+
log "hyperalfred is required (https://github.com/gjuchault/hyperalfred)."
46+
close access target_file
47+
end try
48+
return false
49+
end try
50+
end write_to_file
5.36 KB
Loading

0 commit comments

Comments
 (0)