alfred-css-triggers
Advanced tools
Comparing version 0.1.0 to 0.2.0
'use strict'; | ||
const alfy = require('alfy'); | ||
const triggers = require('./lib/css-triggers'); | ||
const utils = require('./lib/utils'); | ||
triggers.getData() | ||
const parsed = utils.parse(alfy.input); | ||
triggers.getData(parsed.engine) | ||
.then(props => { | ||
const items = alfy | ||
.inputMatches(props, 'name') | ||
.matches(parsed.input, props, 'name') | ||
.map(item => { | ||
@@ -10,0 +13,0 @@ const url = `https://csstriggers.com/${item.name}`; |
@@ -41,2 +41,2 @@ 'use strict'; | ||
exports.getData = () => getData('blink'); | ||
exports.getData = engine => getData(engine || 'blink'); |
'use strict'; | ||
const repeating = require('repeating'); | ||
const engines = ['blink', 'gecko', 'webkit', 'edge']; | ||
exports.toString = props => { | ||
@@ -25,1 +27,19 @@ props = props || {}; | ||
}; | ||
exports.parse = input => { | ||
const matches = input.match(/^(.*?) --(.*?)$/); | ||
if (!matches) { | ||
return { | ||
input: input.trim(), | ||
engine: engines[0] | ||
}; | ||
} | ||
const engine = engines.indexOf(matches[2]) === -1 ? engines[0] : matches[2]; | ||
return { | ||
input: matches[1].trim(), | ||
engine: engine === 'edge' ? 'edgehtml' : engine | ||
}; | ||
}; |
{ | ||
"name": "alfred-css-triggers", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Alfred workflow to search through csstriggers.com", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -5,3 +5,3 @@ # alfred-css-triggers [![Build Status](https://travis-ci.org/SamVerschueren/alfred-css-triggers.svg?branch=master)](https://travis-ci.org/SamVerschueren/alfred-css-triggers) | ||
<img src="screenshot.png" width="694"> | ||
<img src="screenshot.png" width="885"> | ||
@@ -25,3 +25,12 @@ | ||
### Engines | ||
Optionally, you can pass the name of the engine as argument. The following engines are supported. | ||
- `blink` (default) | ||
- `gecko` | ||
- `webkit` | ||
- `edge` | ||
## Related | ||
@@ -28,0 +37,0 @@ |
9445
98
43