Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.77 KB

ARGUMENTS.md

File metadata and controls

32 lines (24 loc) · 1.77 KB

Custom arguments Use argument[1..3] metadata to specify custom arguments that will be displayed as inputs in the search bar when the script is selected. The value of the argument metadata parameter should be valid json with these fields:

Field Description Required App Version
type Input type. For now only "text" value available. 1.2.0+
placeholder Placeholder for the input field. 1.2.0+
optional Set to true if you want to mark the argument as optional. When not provided, the argument is considered to be required (Raycast will not allow to execute the script if the argument input is empty) 1.3.0+
percentEncoded Set to true if you want Raycast to perform percent encoding on the argument value before passing it to the script. Can be handy for scripts that pass the argument directly to URL query 1.4.0+

💡 Maximum number of arguments: 3 (if you have a use case that requires more, please let us know via feedback or in the Slack community)

Here's an example of a simple web search script with two arguments:

#!/bin/bash

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Search Flights
# @raycast.mode silent

# Optional parameters:
# @raycast.icon 🛩
# @raycast.packageName Web Searches
# @raycast.argument1 { "type": "text", "placeholder": "from city", "percentEncoded": true }
# @raycast.argument2 { "type": "text", "placeholder": "to city", "optional": true, "percentEncoded": true }

open "https://www.google.com/search?q=flights%20from%20$1%20to%20$2"

💡Pro tip: When typing alias + space, Raycast will automatically move focus to the first input field.