pedrolaxe/js-terminal

View on GitHub
src/js/terminal/commands/index.js

Summary

Maintainability
A
0 mins
Test Coverage
const names = [
  'nullCommand',
  'openWindowCommand',
  'replyToCreatorCommand',
  'replyToDateCommand',
  'replyToGitPushOriginMasterCommand',
  'replyToGitStatusCommand',
  'replyToHelloCommand',
  'replyToHelpCommand',
  'replyToLoveYouCommand',
  'replyToTimeCommand',
  'searchOnGoogleCommand',
  'searchOnIiissaCommand',
  'searchOnWikiCommand',
  'searchOnYahooCommand',
  'searchOnYoutubeCommand',
];

const commands = names.reduce((hash, name) => {
  hash[name] = require(`./${name}`).default;
  return hash;
}, {});

commands[Symbol.iterator] = function*() {
  for (const name of names) {
    yield commands[name];
  }
};

export default commands;