3

Hadoop has a range of commands and subcommands to specify different operations on MapReduce, HFS etc. (e.g. hadoop dfs can be followed by any command from this list).

Is there any way to enable completion of these commands in Zsh?

In case it helps, I am using Oh-my-zsh.

3

Upstream zsh doesn't have a completion function for hadoop, so your choices are to find someone who wrote one for hadoop or to write your own.

If you are new to writing completion functions, ft wrote a nice introduction here.

The fastest way to learn in my opinion is to read and understand existing functions. since hadoop have subcommands, relevant existing functions are _zfs, _btrfs, _git and other commands that have the concept of subcommands. You can view them with $EDITOR $^fpath/_zfs(N)

the zsh userguide also have a chapter dedicated to how completion works here, and man 1 zshcompsys will quickly become your best friend.

And it is called completion, there is nothing auto about it :P

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.