![]() ![]() So you get completions for everything that supports it if you load with Homebrew. #MAC GIT BASH COMPLETION HOW TO#When you do other brew installs like brew install git for instance, those command know how to load new completions in and it all just works. You just need to load it up and everything works. Well most of the time you don’t need to work about this, if you are on the Mac, then there is a very convenient Homebrew package called bash-completion called brew install for bash v4 and above that takes care of all this. It gets way more complicated than this as you can use compgen which generates possible words based on what’s been typed so far. Means that when you type another_command you will get a list of all directories in the current working directory. Pretty neat right? There are also some alias for common things so complete -A directory another_command ![]() What this says is that if you type mycommand and then hit the tab, you will get a choice of words which are $ mycommand Īnd now if you type in partials like mycommand h it will complete it for you. The real magic here is a bash command called, completion what this does is pretty simple, just run the bash command (there are similar ones for fish and zsh: complete -W "help list execute" mycommand This means that you can type say ls and then when you hit the tab, you get a list of all the files. One of the advances features of shells is what is called Tab Completion. OK I admit it I’ve gotten kind of spoiled. So don’t bother reading unless you have this exact problem. A new feature, I’m labeling my really nerdy programming hacks. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |