3 ms·
Can it be made to be directly executable with a shebang line?
by cedws 11mo ago
Can it be made to be directly executable with a shebang line?
- _joel 11mo agoit already has one - https://github.com/chr15m/runprompt/blob/main/runprompt#L1 https://github.com/chr15m/runprompt/blob/main/runprompt#L1 If you curl/wget a script, you still need to chmod +x it. Git doesn't have this issue as it retains the file metadata.
- vidarh 11mo agoI'm assuming the intent was to as if the *.prompt files could have a shebang line. #!/bin/env runprompt --- .frontmatter... --- The prompt. Would be a lot nicer, as then you can just +x the prompt file itself.
- chr15m 11mo agoThat's on my TODO list for tomorrow, thanks!
- deleted 11mo ago[deleted]
- leobuskin 11mo ago/usr/local/bin/promptrun #!/bin/bash file="$1" model=$(sed -n '2p' "$file" | sed 's/^# \*//') prompt=$(tail -n +3 "$file") curl -s https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "content-type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d "{ \"model\": \"$model\", \"max_tokens\": 1024, \"messages\": [{\"role\": \"user\", \"content\": $(echo "$prompt" | jq -Rs .)}] }" | jq -r '.content[0].text' hello.prompt #!/usr/local/bin/promptrun # claude-sonnet-4-20250514 Write a haiku about terminal commands.
- chr15m 11mo agoThis is cool. An even more minimal bash version. Love it!
- chr15m 11mo agoI added this and you can now make .prompt files with a runprompt shebang. #/usr/bin/env runprompt