Created
March 25, 2025 18:28
-
-
Save AugustMiller/49c2d0c0e296ebcfe377c1719a2f01d6 to your computer and use it in GitHub Desktop.
Raycast Script for fetching callsigns from Hamcall.dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Required parameters: | |
// @raycast.schemaVersion 1 | |
// @raycast.title Callsign | |
// @raycast.mode compact | |
// @raycast.argument1 { "type": "text", "placeholder": "ID" } | |
// Optional parameters: | |
// @raycast.icon 📡 | |
// Documentation: | |
// @raycast.description Get information about a callsign. | |
// @raycast.author August Miller | |
const sign = process.argv.slice(2)[0]; | |
fetch(`https://hamcall.dev/${sign}.json`) | |
.then(function(response) { | |
return response.json(); | |
}) | |
.then(function(json) { | |
if (json.status === 404) { | |
throw `Could’t find callsign “${sign}”`; | |
} | |
const data = [ | |
json.name, | |
json.class, | |
`${json.city}, ${json.state}`, | |
]; | |
console.log(data.join(' / ')); | |
}) | |
.catch(function(err) { | |
console.error(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment