#!/bin/bash # Required parameters: # @raycast.schemaVersion 1 # @raycast.title FSNotes Search # @raycast.mode silent # Optional parameters: # @raycast.icon ./images/fsnotes-icon.png # @raycast.packageName FSNotes # @raycast.argument1 { "type": "text", "placeholder": "Query...", "optional":false } # Documentation: # @raycast.author melonamin # @raycast.authorURL https://github.com/melonamin # Description: # @raycast.description Search notes in FSNotes by keywords. urlencode() { local length="${#1}" for (( i = 0; i < length; i++ )); do local c="${1:i:1}" case $c in [a-zA-Z0-9.~_-]) printf "$c" ;; *) printf '%%%02X' "'$c" ;; esac done } encodedQuery=$(urlencode "$1") searchURL="fsnotes://find/${encodedQuery}" open "$searchURL"