Files
gaardian-alfred-workflow/map.mjs
2023-08-30 16:38:28 +03:00

23 lines
564 B
JavaScript

import list from './list.mjs'
function getMaps(name) {
return list.filter((item) => item.name.toLowerCase().includes(name.toLowerCase()))
}
const results = getMaps(process.argv[2])
const items = results.map((it) => ({
title: `Open Gaardian Map for "${it.name}"`,
arg: it.href,
}))
const qs = new URLSearchParams({ q: `aardwolf ${process.argv[2]}` }).toString()
// if (!items.length) {
items.push({
title: `Search for "aardwolf ${process.argv[2]}" on Google`,
arg: `https://www.google.com/search?${qs}`
})
// }
console.log(JSON.stringify({ items }))