-
Notifications
You must be signed in to change notification settings - Fork 696
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
Feature: alias commands #3849
Comments
I don't think this is a good idea unless we introduce explicit short-aliases for commands on an as-needed basis. (We should probably have per-command usage metrics to guide us even then.) My rationales for not having it:
|
Oh, forgot: I do think it might be a good idea to add some sort of help-the-command-shell-expand-things type functionality such that the [TAB]-expand functionality wouldn't need to be re-implemented in each and every shell. (Unless we already have it, but I don't think so.) Some of this stuff can be "scraped" from "cabal --help" output and "cabal foo --help" output, but that's pretty messy and error prone. Might be nicer to have a more shell-parsing-friendly format for these things. |
For reference, https://github.com/haskell/cabal/blob/master/cabal-install/bash-completion/cabal is our existing bash completion, maintained by @kolmodin I think a feature like this is case of rough consensus and running code. I'm certainly not going to implement it. I think if someone submitted a patch which implemented it and didn't drastically complicate the command handling code, we should take it. Though, I am not too certain how easy this would be to do without changing our command line parsing backend. I've thus milestoned it bottom. |
@BardurArantsson, having used this for years with Accidentally running disruptive commands happens as easily with long commands or shell completion, or even mistakenly running To alleviate the likelihood of users accidentally running the wrong unabbreviated command, we can make this opt-in, just like split-objects is. Alternatively, we could by default allow only safe commands to be unabbreviated and, if desired, provide a feature to selectively enable disruptive commands as well. Another viable approach, and likely to be less controversial, is the introduction of a proper alias feature where users can define aliases. Thinking about it, aliases are useful for other cases as well, and are probably the more universal and preferable feature to implement. I've changed the ticket's title accordingly.
I like the idea of cabal aliases, not to be confused with your shell's alias support, which is different and pollutes the shell's namespace. |
I have no objections to alias-type things. (Nor opt-in abbrev support for that matter -- except on code complexity/maintenance grounds.) |
Alias support is probably easier (less complex) to implement and is of more universal use anyway. |
See #1089 for previous discussion. |
Revised idea:
Alias support like
is probably the more universal and less complex feature to implement that would provide similar functionality.
Original idea:
Given that we have various commands that aren't short but typed frequently, I would welcome a feature (that we added to the Erlang build tool called rebar a couple years ago) which allows you to abbreviate the commands to run and will unabbreviate if there's a unique match, or list potential candidates otherwise:
So, in cabal-install it would be:
The text was updated successfully, but these errors were encountered: