Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: accept csv for array values #8933
cli: accept csv for array values #8933
Changes from 2 commits
6b8c607
9fe961a
35e2f01
879b288
3e3cc4c
ee44360
0d1a611
0067f00
6f58b90
e4da3a9
d49db90
2402ce8
2b46961
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ends up somewhat confusing from the caller's perspective since it's no longer explicitly optional (even though we usually call it with no args) and when we do pass an argument it's still a single string (it's annoying that the
yargs
types require this becauseyargs
definitely supports parsing just a string).What about keeping it
string=
and doingconst y = manualArgv ? yargs([manualArgv]) : yargs;
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused on how it's confusing to the caller?
if reverting the change, would you want the code using multiple args (admittedly it's just test code) to look like this?
or this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes from me. Maybe it's just that I haven't been completely indoctrinated to rest parameters yet, but to me an optional
manualArgv?: string
parameter is a lot clearer than...manaulArgv: string[]
at informing that the argument is optional. It's not a huge deal since it's not a commonly used interface, but it's only test code that uses this, so it makes sense to me to make the real use case clear in the signature.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, actually, that test failure may be because our version of yargs doesn't take an array at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It passes locally.
(EDIT: misread the build log. one sec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok the issue is that if you pass in an array, you cannot have each item have multiple args. test just needs to change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also I guess they expect some preprocessing, b/c
=
is required too. 6f58b90There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can only omit the
=
when passing in as a single string? This seems like the real downside...we should be able to write tests using both styles since the real deal accepts bothThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not 100% sure that I love mutating the arguments in a
.check
methodWDYT of just saving the
.argv
to a variable and mutating that before we return ingetFlags
?I think that might help make it more explicit that we are doing some non-standard yargs mutations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love that this is here and I'm not sure we can actually do this across the board.
(for example
--chrome-flags="--window-size 800,600"
)WDYT about just doing this to our specific
.array
properties minusblockedUrlPatterns
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok. sounds like either way we need a hard coded list (either a blacklist of a whitelist). Whitelist is easier to reason about so let's do that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once we figure out other feedback would love the
--window-size
andblockedUrlPattern
counter examples here too :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blockedUrlPattern
just b/c comma could be in a pattern? what if we could escape it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm lets not do that :)