npm.io
0.1.0 • Published 4 years agoCLI

alfons

Licence
MIT
Version
0.1.0
Deps
8
Size
52 kB
Vulns
1
Weekly
0

Alfons

Create Alfred workflows in Javascript

Features

  • Easy setup with npx alfons init
  • No Node.js requirement for users
  • Built-in fetch that follows the Fetch API standard
  • Access Alfred config and environment variables
  • Support for AppleScript/JXA
  • Easy build process

Getting started

First, create a new Blank Workflow. Fill in the desired fields.

Right click your new workflow, and Open in Terminal. Run the following command

npx alfons init

That's it. Open the newly created index.js file and get coding!

Example

import alfons from "alfons";

export const run = (argv) => {
  const input = argv[0].trim();

  const todos =  alfons.fetch('https://jsonplaceholder.typicode.com/users/1/todos');

  alfons.output(todos.map(todo => ({
    title = todo.title,
    subtitle = todo.completed ? "Completed" : "Not completed",
    arg = todo.id
  })));
}