Wrapper for alfred workflow item in Node.js / io.js.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
LICENSE
README.md
index.js
package.json

README.md

Alfred Item

Wrapper for alfred workflow item in Node.js / io.js.

Installation

$ npm install alfred-item

Usage

First you should require this package:

var AlfredItem = require("alfred-item");

Then you should new an item:

var item = new AlfredItem();

You may add an item into it:

item.addItem(uid, title, subtitle, icon, options);

uid is the uid attribute of item.

options which is optional contains several key-value pairs live as attributes in item.

For an example, when options is like:

{ autocomplete: "" }

The result will be like:

<item uit="..." autocomplete="">
  <title>...</title>
  <subtitle>...</subtitle>
  <icon>...</icon>
</item>

You may delete an item via uid:

item.delItemViaUid(uid);

And you may get the XML string:

var xml = item.output();
console.log(xml);
console.log(item);

All APIs

addItem(uid, title, subtitle, icon[, options]);
delItemViaText(key, text);
delItemViaAttr(key, attr);
delItemViaTitle(title);
delItemViaSubtitle(subtitle);
delItemViaIcon(icon);
delItemViaUid(uid);
output();

Contribute

You're welcome to make pull requests!