-
Notifications
You must be signed in to change notification settings - Fork 379
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 alias and default command parsing #5160
base: main
Are you sure you want to change the base?
Conversation
Also, do we really want to forbid the user from aliasing built-in commands? |
84d0f6f
to
5dd0e84
Compare
Any reason for this?
This wouldn't correctly handle cases where one of the arguments is a quoted string with whitespace within, would it? I'm not sure if there's a good enough justification for this then. |
#3034 Comes to mind. But my understanding is that we want to make using the
Not it wouldn't, and intentionally so. I don't want to implement a shell here. This is just a convenience thing that I've found myself personally wanting. If you want argument parsing, there's always the full array syntax. The alternative would be to treat single strings as single arguments, but that would go counter to what I would expect. (Also, see what git does). That said, we could forbid quotes (", ' and `) to prevent this particular footgun. In fact I'm gonna do that right now. |
I'll remove whitespace splitting and restore the old behaviour for now |
37917a3
to
2be3011
Compare
Ok, this is just the refactor now. I tried to do too much in one pr I think. Only real change now should be that you can specify single-command (no argument) aliases with a string. This is already possible for default-command, but now it is also possible in aliases. |
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.
cli: simplify argument expansion code
Could you add some more detail? This patch adds 39 lines of code, so it's not an obvious simplification. It would be good to know why you're doing it (if it's not only to make the code simpler). Since it's a non-trivial patch, it's also good to explain how you're refactoring the code so the readers don't have to spend so much time to try to figure out what's going on.
2be3011
to
488601c
Compare
488601c
to
05a470a
Compare
I'm trying to pull config parsing out of the cli. But to do that, we need to untangle config parsing and argument parsing. This is part of that.
As a bonus, you can now specify single-comamnd aliases as a string.
Checklist
If applicable:
CHANGELOG.md