opened
kdlslyv
username_0
Hi,

In earlier versions I could input options like this one:

`exec Do-Stuff --stuff "great stuff"`

this does not check out currently.
Having `yargs` in earlier versions did this really well.

For reproduction, use the demos `reverse` command like this:
`reverse "text with space"`
Spaces in options
issue
created
ndabAP
username_1
I'll propagate the issue to `getopts` and will see if they react. If not I'll switch back to `yargs`.
comment
created
jorgebucaran
username_2
Hi everyone. I couldn't reproduce any issue with spaces in getopts, but [found that here](https://github.com/username_1/vue-command/blob/6f19260da4413a956933be0dbc5d90a9f77797c6/src/hosted/App.vue#L159), `stdin` was something like:

```console
reverse "a b c"
```

So, instead of `stdin.split(' ')[1]`:

```js
const argument = stdin.split(' ').slice(1).join(' ')
```

or 

```js
const argument = stdin.split(' ').slice(1).join(' ').replace(/"/g, '')
```

(if you also want to get rid of `"`s.)

And it seems to be working now. Hope I was able to help! 👋 

<img width="1440" alt="スクリーンショット 2020-06-12 17 28 49" src="https://user-images.githubusercontent.com/56996/84482362-8d2f0500-acd2-11ea-8731-9917d070c83c.png">
comment
created
ndabAP
username_1
@username_0 please see @username_2 post. Do you may have another reproduction example?
comment
created
ndabAP
username_1
Well guys, lack of sleep and stress lead to this. I need to correct this: The `reverse` command is a built-in command and not parsed by `getopts` at all. Built-in commands can use their own parser.
comment
created
kdlslyv
username_0
looks good; I suppose I erroneously made the same mistake. Will test tmr and close this.
Thank you for the replies & quick solution guys!
comment
created
jorgebucaran
username_2
I just [added a new test](https://github.com/username_2/getopts/commit/71c4f3a41b3a9056793f09bbc018766a5b9696f1) to cover whitespace with long options too. Thanks! :)
comment
created
ndabAP
username_1
Great,
comment
closed
ndabAP
username_1
issue
created
kdlslyv
username_0
thanks for the quick resolution, working with stdin works.

however when using the `({ _ })` [see here](https://github.com/username_1/vue-command/blob/6f19260da4413a956933be0dbc5d90a9f77797c6/src/hosted/App.vue#L125) - the bug still applies, try `cd "te st"`
it'll list it like this in the array: `"te, st"`
comment
created
jorgebucaran
username_2
@username_0 Hmm that's probably not a bug in getopts, but if you could create a minimal reproduction of the bugs with getopts, I'd have a look right away.
comment
created
kdlslyv
username_0
@username_2 thank you for your effort, but `getopts` does its job flawlessly.

the culprit is this in [handle.js](https://github.com/username_1/vue-command/blob/b01b2adbaba0a4717f861047ad2b606a3d7f50b0/src/mixins/handle.js#L42)

I've hacked around it using the `stdin.sync` prop and a rather hacky solution parsing how I want it, it probably is not the most fitting solution that'd apply to anyone, otherwise I'd open a pull request.
comment
created
ndabAP
username_1
@username_0 I'd appreciate a PR!
comment
created
kdlslyv
username_0
@username_1 thanks - I'll put something worthwhile (hopefully - we'll check) together on the weekend, wouldn't want to pollute this awesome project 🙈
comment
reopened
ndabAP
username_1
Hi,

In earlier versions I could input options like this one:

`exec Do-Stuff --stuff "great stuff"`

this does not check out currently.
Having `yargs` in earlier versions did this really well.

For reproduction, use the demos `reverse` command like this:
`reverse "text with space"`
Bug: Spaces in options
issue
closed
ndabAP
username_1
issue
created
ndabAP
username_1
:tada: This issue has been resolved in version 15.0.1 :tada:

The release is available on:
- [npm package (@latest dist-tag)](https://www.npmjs.com/package/vue-command/v/15.0.1)
- [GitHub release](https://github.com/username_1/vue-command/releases/tag/v15.0.1)

Your **[semantic-release](https://github.com/semantic-release/semantic-release)** bot :package::rocket:
comment