Arguments enable users to provide input when running your Script Command. Use them to create interactive scripts that search, configure, or process custom data.
Set to true to make the argument optional. When false or omitted, Raycast won’t execute the script until the field is filled.Default:falseApp Version: 1.3.0+
Set to true to automatically percent-encode the argument value before passing it to the script. Useful for URL parameters.Default:falseApp Version: 1.4.0+
Arguments are passed to your script as positional parameters:
Bash
Python
JavaScript
Ruby
Swift
AppleScript
#!/bin/bash# @raycast.argument1 { "type": "text", "placeholder": "Name" }# @raycast.argument2 { "type": "text", "placeholder": "Age" }NAME=$1AGE=$2echo "Hello, $NAME! You are $AGE years old."
#!/usr/bin/env python3# @raycast.argument1 { "type": "text", "placeholder": "Name" }# @raycast.argument2 { "type": "text", "placeholder": "Age" }import sysname = sys.argv[1]age = sys.argv[2]print(f"Hello, {name}! You are {age} years old.")
#!/usr/bin/env node// @raycast.argument1 { "type": "text", "placeholder": "Name" }// @raycast.argument2 { "type": "text", "placeholder": "Age" }const [name, age] = process.argv.slice(2)console.log(`Hello, ${name}! You are ${age} years old.`)
#!/usr/bin/env ruby# @raycast.argument1 { "type": "text", "placeholder": "Name" }# @raycast.argument2 { "type": "text", "placeholder": "Age" }name = ARGV[0]age = ARGV[1]puts "Hello, #{name}! You are #{age} years old."
#!/usr/bin/swift// @raycast.argument1 { "type": "text", "placeholder": "Name" }// @raycast.argument2 { "type": "text", "placeholder": "Age" }let name = CommandLine.arguments[1]let age = CommandLine.arguments[2]print("Hello, \(name)! You are \(age) years old.")
#!/usr/bin/osascript# @raycast.argument1 { "type": "text", "placeholder": "Name" }# @raycast.argument2 { "type": "text", "placeholder": "Age" }on run argv set name to item 1 of argv set age to item 2 of argv log "Hello, " & name & "! You are " & age & " years old."end run
#!/bin/bash# @raycast.argument1 { "type": "text", "placeholder": "Port number" }PORT=$1# Validate port numberif ! [[ $PORT =~ ^[0-9]+$ ]]; then echo "Error: Port must be a number" exit 1fiif [ $PORT -lt 1 ] || [ $PORT -gt 65535 ]; then echo "Error: Port must be between 1 and 65535" exit 1fiecho "Starting server on port $PORT"
For inline and compact modes, the last line of output becomes the error message when the script exits with a non-zero status code.