-
Notifications
You must be signed in to change notification settings - Fork 576
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
also support command names with hyphens #1372
also support command names with hyphens #1372
Conversation
8ab3efc
to
967b4ca
Compare
You can squash the "fix" commit into the original one, as it makes the history tidier. |
Why not $ perl -MMojo::Util=camelize -E 'say camelize q{my-command}'
My::Command |
967b4ca
to
3659098
Compare
@kiwiroy |
@karenetheridge hmm, it is. I forget |
Should underscore commands also show up with hyphens in the command list?
|
Possibly. Where would be a good place to list them? If they get their own line, the help list would grow a lot if most of the commands had underscores . Maybe this instead (using my app as an example as it has some underscore commands)?
|
I imagine it wouldn't show the underscore versions at all then. |
I don't mind this as a quality-of-life thing[1], but I'd prefer the documentation and command listing to match the actual module name. Though.. if both are allowed, documentation involving commands is going to end up as a mix of the two, depending what the author prefers. Not within Mojolicious itself, but articles written about it, command SYNOPSIS', etc. As a side-note, as commands can start with underscores, this would allow commands like I don't usually have multi-word commands, they end up as subcommands. For example, with the [1] I say, then proceed to list a bunch of objections and concerns.. :) |
oooh. The more I stare at this the more I can't decide if this is something that should be disallowed, or could be a really nifty feature... I am not evil enough to divine interesting ways this could be abused. I have no objections to not changing the 'help' text at all, simply silently accepting an alternate spelling for the command. |
I'm neutral to this change. |
Commands starting with an underscore are a blocker for this feature. |
As this has headed into having to implement a breaking change (restricting command names) to introduce, my vote has changed to against. It seems a bit excessive to restrict command names (and potentially break existing commands in the process) just to avoid the potential of having to use the shift key when typing a command. If your commands have more than one underscore, it may be of more benefit to refactor it into sub-commands.
|
Could you clarify what you mean by this? Commands can start with an underscore now, can they not? |
It's a blocker because, if this is accepted, commands that start with an underscore look like dash options.
Whereas currently, they would just look odd:
This is why it has been suggested that commands with leading underscores be prohibited, so it would no longer be a blocker for this change. |
Is that a request that I change the patch to do that? That wasn't clear to me. I have no objection to this either way. |
3659098
to
67c7cf4
Compare
I have changed |
..by mapping them to the equivalent underscore command class (except for leading - which is left alone, to disallow commands such as '-foo')
67c7cf4
to
aa0e9af
Compare
I have rebased this to the current master. Is there anything else I can do to make this more satisfactory? |
Calling for a vote @mojolicious/core. |
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 vote 👎 on this proposal, since i fear more alternatives for how to specify commands might cause confusion. Even if in general i like foo-bar
more than foo_bar
for command names.
I'm neutral, I like the foo-bar style too but I fear gotchas with this solution. |
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 neutral, it would be nice to support but I don't see a way to do it without potential for confusion.
Same reasoning as @kraih. 👎 from me. |
..by mapping them to the equivalent underscore command class
Summary
mojo my-command
will now look for MyApp::Command::my_command, not just ::my-command.Motivation
kebabs are tastier than snakes on the command line
References
as discussed on irc today, 2019-06-24.