Skip to content

Instantly share code, notes, and snippets.

@simonbs
Last active April 18, 2020 10:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonbs/11e1693e6016bfb4a1de5fed269c7e92 to your computer and use it in GitHub Desktop.
Save simonbs/11e1693e6016bfb4a1de5fed269c7e92 to your computer and use it in GitHub Desktop.
Lists unique tags across multiple files. To be used with Shortcuts.
let fm = FileManager.iCloud()
let filePaths = args.fileURLs
let tags = filePaths.reduce((cur, e) => {
return cur.concat(fm.allTags(e))
}, [])
let uniqueTags = tags.filter((t, idx) => {
return tags.indexOf(t) === idx
})
let output = {"tags": uniqueTags}
Script.setShortcutOutput(output)
Script.complete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment