darlanmendonca / shell-arguments

Convert shell arguments to json
MIT License
10 stars 1 forks source link

It seems it just doesn't work #4

Open AlexeyGorokhov opened 8 years ago

AlexeyGorokhov commented 8 years ago

I've given it a try but the module seems to work incorrectly.

build/html-builder.js

const shellArguments = require('shell-arguments');
console.dir(shellArguments, { depth: null });

The command $ node build/html-builder --t dev returns what's expected: { t: 'dev' }.

But other documented variations just give unexpected results:

$ node build/html-builder -t dev -> { t: true }

$ node build/html-builder -t 'dev' -> { t: true }

$ node build/html-builder -t='dev' -> { t: true, '=': true, d: true, e: true, v: true }

darlanmendonca commented 8 years ago

Thanks for help @AlexeyGorokhov!!

I thought when has just one -, does not allow attribution. But you're right, if has just a char, i.e. -t 'dev', need return a object {t: 'dev'}.

Now, if user type -tpq 'dev', or -tpq='dev', what is object expected? {t: 'dev, p: 'dev, q: 'dev'} or {t: true, p: true, q: 'dev'}?

AlexeyGorokhov commented 8 years ago

Hi @darlanmendonca! I guess, the behavior documented in your readme.md is correct. The problem is that the module doesn't output what's documented.

simonbuchan commented 5 years ago

Now, if user type -tpq 'dev', or -tpq='dev', what is object expected? {t: 'dev, p: 'dev, q: 'dev'} or {t: true, p: true, q: 'dev'}?

Unix convention is the latter.