loading...

Discussion on: Bash Functions and Aliases for the Beginning Docker Developer

Collapse
ericdraken profile image
Eric Draken

This is great. Now, how would one go about bash-completing the multi-level command aliases and functions?

Collapse
argherna profile image
Andy Gherna Author

Maybe a customization to bash-completion? I think that's a little heavy though. Mostly because aliases and functions are short and are meant to be short. I don't need the shell to remember it for me; I taught the shell what I wanted to do with little effort for both of us (me and the shell).

Collapse
ericdraken profile image
Eric Draken

With Docker (e.g. your deb alias), you would want to [tab][tab] container names and image ids, would you not?

Thread Thread
argherna profile image
Andy Gherna Author

Sure, that'd be great! But again, that's more effort than the beginning Docker user might do. The expert Bash user could make that happen. Again, bash-completion would be the right thing here, not these aliases and functions.

Where this post was coming from was my work on a recent sprint our team was doing to prove a concept with our web ISO. I had to learn how to use Docker and get my work done. There wasn't time for me to go into doing much more than what I did and be able to get my work done on time and this was a reasonable compromise for me.

Thread Thread
ericdraken profile image
Eric Draken

Docker has bash completion already, thankfully. The trick is to get the aliases to ride the coat tails of the original functions for bash completion. It turns out it isn't that hard to coax them. If you're interested, here is how I figured it out: stackoverflow.com/questions/477816...