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
Unify string subcommand parameter passing behavior #5837
Comments
So, what's your proposal? Note that either requiring a I'm imagining the reason that |
Yes, the current behaviour doesn't seem all that surprising to me. An optional |
@faho not suggesting any required changes, merely adding |
This would need to be quite carefully done if we want to keep compatibility. One possibility would be to only use it in argv iff the strings are passed via stdin. Because otherwise: string trim ' first' 'second ' would print
One difference between
or to
Or do we want to add another option to both that uses its argument as a string? |
I always mix up how to pass characters to
string trim
andstring split
, both of which ostensibly could have default values (whitespace and either whitespace or new lines, respectively) and allow for a custom delimiter/value to be specified. One requires-c __
to specify the value, the other takes__
as a parameter directly. (There may be other subcommands similarly affected).While at it, both of these actually could (and should, imho) support multiple arguments, e.g. "trim any of the following" and "strip any of the following", respectively. One of them errors out if multiple are provided, the other silently discards the extra argument.
Forutnately, in the case of these two subcommands, I believe they could both be extended to support both sets of behavior without any conflict with existing code (but I could be wrong).
I leave it to the reader to recall which of the descriptions above apply to which of these subcommands 😄.
The text was updated successfully, but these errors were encountered: