Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. const vorpal = require('vorpal');
  2. const cli = vorpal();
  3.  
  4. cli
  5. .command('newprovider <handle> <name>', 'Creates a new provider, eg. `newprovider new "New provider"`')
  6. .action(function(args, cb) {
  7. const { handle, name } = args;
  8.  
  9. console.log(`Creating provider with handle ${handle} and name ${name}`);
  10. this.prompt([
  11. {
  12. type: 'input',
  13. name: 'url',
  14. message: 'Enter a local path or a url of the provider logo '
  15. }
  16. ]).then(result => {
  17. console.log(`URL: ${result.url}`);
  18. cb();
  19. });
  20. });
  21.  
  22. cli.show();
  23.  
  24. cli.exec('newprovider fuzz "Fuzz Provider"', () => {
  25. // Callback gets called AFTER the prompt has resolved.
  26. console.log('Callback');
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement