Skip to content

Instantly share code, notes, and snippets.

@ErisDS
Created April 16, 2019 18:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErisDS/3a9132089955b2698135257a72fa30cb to your computer and use it in GitHub Desktop.
Save ErisDS/3a9132089955b2698135257a72fa30cb to your computer and use it in GitHub Desktop.
Extending sywac dynamically
#!/usr/bin/env node
const prettyCLI = require('@tryghost/pretty-cli');
const slimer = require('@tryghost/slimer');
const extensions = require('../extensions');
// Require internal commands
prettyCLI.commandDirectory('../commands');
slimer
.loadCommands()
.then((commands) => {
commands.forEach((command) => {
// Load either our extended command, or the original
prettyCLI.command(extensions[command.id] ? extensions[command.id](command) : command);
});
prettyCLI.parseAndExit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment