Skip to content

Commit

Permalink
Merge branch 'release/v1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeboer committed Jul 25, 2017
2 parents 0c81a74 + 8f15788 commit e7b0da0
Show file tree
Hide file tree
Showing 22 changed files with 6,579 additions and 593 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"plugin:ava/recommended"
],
"env": {
"node": true,
"browser": false
"node": true
},
"rules": {
"indent": [
Expand Down
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,16 @@ Item to add to the list of items which will be displayed. The only property that

###### Item variables

One thing that is simplified in Hugo (and quite undocumented in Alfred) is the way to add variables to items using the `arg` property. Instead of supplying a `string` you can supply an `Object` to assign variables to an item instead of globally. Now when an item is activated it will set those environment variables during this session so you can use them throughout your Alfred workflow in other actions.
~~One thing that is simplified in Hugo (and quite undocumented in Alfred) is the way to add variables to items using the `arg` property. Instead of supplying a `string` you can supply an `Object` to assign variables to an item instead of globally. Now when an item is activated it will set those environment variables during this session so you can use them throughout your Alfred workflow in other actions.~~

Since [version 3.4.1](https://www.alfredapp.com/help/workflows/inputs/script-filter/json/#variables) Alfred now supports item and item modifier variables and have added documentation on the subject. You don't have to worry about what version of Alfred is running, Hugo takes care of that so you can use either syntax, though we prefer the new ​:smile:​.

Old syntax:

```javascript
{
title: 'My item',
valid: true,
arg: {
arg: 'my argument',
variables: {
Expand All @@ -238,6 +243,29 @@ One thing that is simplified in Hugo (and quite undocumented in Alfred) is the w
}
```

New (preferred) syntax:

```javascript
{
title: 'My item',
valid: true,
arg: 'my argument',
variables: {
foo: 'bar',
bleep: 'bloop'
},
mods: {
alt: {
valid: true,
arg: 'my alt argument',
variables: {
bar: 'foo'
}
}
}
}
```

#### Hugo.addItems(items)

##### items
Expand Down Expand Up @@ -273,12 +301,38 @@ Type: `string` `Object`

See the [Alfred documentation](https://www.alfredapp.com/help/workflows/inputs/script-filter/json/) for more info about session variables.

#### Hugo.getVariable(key)

Type: `string`

Get the value of a session variable, see Hugo.addVariable for more info.

##### key

Type: `string`

#### Hugo.addVariables(variables)

##### variables

Type: `Object`

#### Hugo.getVariables()

Type: `Object`

Get all the session variables, , see Hugo.addVariables for more info.

#### Hugo.getItemVariables(item)

Type: `Object`

Get all the item variables without having to deal with version differences, see Hugo.addItem for more info.

##### item

Type: `Object`

#### Hugo.action(keyword, callback)

##### keyword
Expand Down Expand Up @@ -387,6 +441,16 @@ Type: `Object`

[Fuse.js](http://fusejs.io) options, please see the [documentation](https://github.com/krisk/fuse#usage) for available options.

#### Hugo.notification(options)

Display a notification using [node-notifier](https://www.npmjs.com/package/node-notifier). For all available configuration options see their documentation.

The title option defaults to the workflow name or 'Alfred' when not available for some reason.

##### option

Type: `Object`

#### Hugo.rerun(value)

> Scripts can be set to re-run automatically after an interval using the 'rerun' key with a value of 0.1 to 5.0 seconds. The script will only be re-run if the script filter is still active and the user hasn't changed the state of the filter by typing and triggering a re-run.
Expand Down
2 changes: 1 addition & 1 deletion examples/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* A very easy way to split your code whilst not having to split it up in seperate files, keeping things nice and tidy.
*/

const Hugo = require('alfred-hugo');
const Hugo = require('../');

// Aliens action (/usr/local/bin/node index.js aliens "$1")
Hugo.action('aliens', query => {
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* only filters the output data and only by title but it is FAST! Use it if you don't require fancy filtering options.
*/

const Hugo = require('alfred-hugo');
const Hugo = require('../');

// Add items to Hugo
Hugo.addItems([
Expand Down
Loading

0 comments on commit e7b0da0

Please sign in to comment.