HADOOP-8795 I discovered other problems and this ticket. The 'hadoop' executable has changed even more since Paul proposed his patch, so I've made some additional changes to get it all working. I found that some of the utilities used have very different versions across the major distros and this caused some problems. I'd love it if this could get committed to trunk, but I'd love it even more if anybody would be willing to source this on their system and let me know if they still find any issues when trying to auto-complete. I have:
*Removed auto-completion of commands that have been deprecated and/or removed entirely.
*Changed RegEx's and other parameters to play nice with the versions of utilities I tested with.
Also, the script originally parsed the built-in documentation to decide if each parameter would be a local path or a remote path. With some commands it is no longer trivial to determine which parameter is which, so I combine the results from the local and distributed file systems. If there are multiple results that will get listed, I append "(dfs)" or "(local)", but this addition should never make it into the actual completion of what the user types.
My only lingering concern (other than compatibility with additional versions of BASH, AWK, etc...) is that sometimes querying HDFS can take a second or two. It might make for a better user experience if the query timed out after a second or so the terminal doesn't freeze up every time they hit 'tab', but overall I think it would be worse, so I've left it as-is. Any thoughts on that?