Skip to content

Commit

Permalink
Merge pull request #10 from aexmachina/master
Browse files Browse the repository at this point in the history
Added support for Fish
  • Loading branch information
rauchg authored Mar 18, 2017
2 parents 57b6509 + 43fdb70 commit fbf9869
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const PARTICLE_VELOCITY_RANGE = {
exports.middleware = (store) => (next) => (action) => {
if ('SESSION_ADD_DATA' === action.type) {
const { data } = action;
if (/(wow: command not found)|(command not found: wow)/.test(data)) {
if (detectWowCommand(data)) {
store.dispatch({
type: 'WOW_MODE_TOGGLE'
});
Expand All @@ -28,6 +28,15 @@ exports.middleware = (store) => (next) => (action) => {
}
};

function detectWowCommand(data) {
const patterns = [
'wow: command not found',
'command not found: wow',
'Unknown command \'wow\''
];
return new RegExp('(' + patterns.join(')|(') + ')').test(data)
}

exports.reduceUI = (state, action) => {
switch (action.type) {
case 'WOW_MODE_TOGGLE':
Expand Down

1 comment on commit fbf9869

@regisbsb
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you push to hpm?

Please sign in to comment.