Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xadillax/alfred-item
Wrapper for alfred workflow item in Node.js.
https://github.com/xadillax/alfred-item
alfred alfred-workflow
Last synced: 5 days ago
JSON representation
Wrapper for alfred workflow item in Node.js.
- Host: GitHub
- URL: https://github.com/xadillax/alfred-item
- Owner: XadillaX
- License: mit
- Created: 2015-02-12T05:54:28.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-10-18T23:11:53.000Z (26 days ago)
- Last Synced: 2024-11-01T09:51:34.646Z (12 days ago)
- Topics: alfred, alfred-workflow
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Alfred Item
Wrapper for alfred workflow item in Node.js.
## Installation
```sh
$ npm install --save alfred-item
```## Usage
First you should require this package:
```javascript
var AlfredItem = require('alfred-item');
```Then you should `new` an item:
```javascript
var item = new AlfredItem();
```You may add an item into it:
```javascript
item.addItem(uid, title, subtitle, arg, icon, arg, options);
```> `uid` is the `uid` attribute of item.
>
> `arg` is optional which indicates `arg` field in output.
>
> `options` is also optional which contains several key-value pairs live as attributes in item.
>
> For an example, when options is like:
>
> ```javascript
> { autocomplete: '' }
> ```
>
> The result will be like:
>
> ```xml
>
> ...
> ...
> ...
> ...
>
> ```You may delete an item via uid:
```javascript
item.delItemViaUid(uid);
```And you may get the XML string:
```javascript
var xml = item.output();
console.log(xml);
console.log(item);
```## All APIs
```javascript
addItem(uid, title, subtitle, icon[, arg[, options]]);
delItemViaText(key, text);
delItemViaAttr(key, attr);
delItemViaTitle(title);
delItemViaSubtitle(subtitle);
delItemViaArg(arg);
delItemViaIcon(icon);
delItemViaUid(uid);
output();
```## Contribute
You're welcome to make pull requests!