dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

Handle double quotation marks arguments as literal strings #38

Closed fnky closed 8 years ago

fnky commented 8 years ago

When passing arguments (or option values) surrounded with double quotes it should handle the input as literal strings and not split by any whitespace, nor should it parse it.

vorpal
  .command('say <text>')
  .option('-n, --name <nm>')
  .action(function (args, cb) {
    this.log((args.options.name ? args.options.name + ': ' : '') + args.text)
    cb()
  })
node~$ say "Hello World"
Hello World
node~$ say 'Innovation distinguishes between a leader and a follower.' --name 'Steve Jobs'
Steve Jobs: Innovation distinguishes between a leader and a follower.

Currently only single quotation marks are supported. I would also propose quotation marks to be optional (both individually and collectively)

dthree commented 8 years ago

Good point. I'll get to this as soon as I can.

dthree commented 8 years ago

All good now.

Haha - that traced back to a September commit where I was replacing double-quotes to singles and accidentally replaced the regex.

Whoops...