Closed (fixed)
Project:
Drush
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Aug 2009 at 18:38 UTC
Updated:
30 Nov 2009 at 02:17 UTC
Jump to comment: Most recent file
Similar to the "svn checkout" vs "svn co".. this was requested in #528016: Create ishacked drush command.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | drush.aliases.patch | 1.78 KB | IncrediblyKenzi |
Comments
Comment #1
moshe weitzman commentedi think git allows for personal aliases in a config file. is that whats requested here? why not use bashrc for that?
Comment #2
sethcohn commentedThis is more along the lines of 'svn co' being equiv to 'svn checkout'.
With the current drush command options, there is no way to do aliases cleanly.
The iscorehacked patch used a method that 'works': define a new command, then just call the truly desired command, but the side effect is that both show up as unique commands in the show commands list. This was considered undesirable, and so it was removed.
Adding true alias support would allow 'drush en' to be equiv to 'drush enable', for example.
Comment #3
moshe weitzman commentedOK - command defined aliases then. Anyone up for a patch?
Comment #4
IncrediblyKenzi commentedYup.. here ya go.
Hides aliases from the command output. Not sure if we want a help option for showing aliases.
But basically in hook_drush_command you can define:
Comment #5
jonhattanI've applied the patch and defined a 'aliases' => array('a', 'b') in a command. It worked nice.
Comment #6
sethcohn commentedLooks good. +1.
Potential and very optional suggestions:
1) Add an alias argument to help, to also show aliases for all commands.
2) alias existing commonly used core commands:
watchdog = wd
enable = en
disable = dis
status = stat
statusmodules = sm
update = up
updatecode = upc
updatedb = updb
dl = download (hmm, interestingly, this is a shortcut name, but does not have a long form 'english' name unlike every other drush command,
if nothing else, this one is worth doing just to fix that)
Comment #7
rsvelko commentedThe most important part of this thing is that we will collaboratively agree on a certain map of aliases. Standartization will do great in this area - else everybody will try to invent his own aliases in bashrc...
Comment #8
jonhattan`dl` could be changed to `download` and `dl` be an alias for `download`.
Comment #9
moshe weitzman commentedIs anyone else concerned that we will see lots of collisions in alias names? How can we handle that gracefully? Could we drop into interactive mode and ask the user what he means?
We need to tell the user about aliases. The most logical place IMO is in the main help table. We should append the alias list to the command name. So, something like: watchdog show (ws).
Makes sense to add the list that set proposes in #6 along with jonhattan suggestion in #8 (dl as an alias for download).
Comment #10
anarcat commentedI agree we should watch out for collisions. In case of ambiguity, just exit with an error.
I would rather have 'dl' be an alias and 'download' the real command if we go that way.
Ideally, drush could guess which command you want if you type just enough characters too, so we wouldn't have to define explicit aliases all the time. I think this is how svn works.
But I don't oppose the patch per se. I think it would need documentation however.
Comment #11
moshe weitzman commentedLets deal with collisions in another issue. They are not handled well today, so we need not introduce handling here.
I looked at this again and am now happy to have it. Could someone extend the patch do that we display aliases on the main help output and on the commmand detail help? Also, lets add aliases per $6 and #8. #8 can be a followup patch.
Comment #12
moshe weitzman commentedI went ahead and implemented all that we discussed here and then committed. This is pretty nice.
Comment #14
dman commentedSmall issue arising from the alias code - with E_ALL, I get a huge list of
Undefined index: is_aliasfrom drush itself.
eg when just running
drush -v help.A tidy fix is
Placed against this issue, not a new one, because it's pretty small - a post-commit review :-)
(Looking at it, I realize it's highly unlikely a sane person would want verbose help ... but hey, I hit it :-)
Comment #15
brad.bulger commentedi hit that too, debugging my own command files. i take the 5th on the issue of sanity, though.