wechat wss demo

example.js 548B

12345678910111213141516171819202122232425
  1. var program = require('./')()
  2. , minimist = require('minimist')
  3. , result
  4. result = program
  5. .register('abcd', function(args) {
  6. console.log('just do', args)
  7. })
  8. .register('args', function(args) {
  9. args = minimist(args)
  10. console.log('just do', args)
  11. })
  12. .register('abcde code', function(args) {
  13. console.log('doing something', args)
  14. })
  15. .register('another command', function(args) {
  16. console.log('anothering', args)
  17. })
  18. .parse(process.argv.splice(2))
  19. if (result) {
  20. console.log('no command called, args', result)
  21. }