zshでcpanコマンド補完


すでにあるかなと思いつつも書いてみた。


以下のファイルを「_cpan」として$fpath に入れる。


とこうなる。

$ cpan -[TAB]
-A  -- Shows the primary maintainers for the specified modules
-C  -- Show the "Changes" files for the specified modules
-D  -- Show the module details.
-L  -- List the modules by the specified authors.
-O  -- Show the out-of-date modules.
-a  -- Creates the CPAN.pm autobundle with CPAN::Shell->autobundle.
-c  -- Runs a `make clean` in the specified module's directories.
-f  -- Forces the specified action, when it normally would have failed.
-h  -- Prints a help message.
-i  -- Installed the specified modules.
-m  -- Makes the specified modules.
-r  -- Recompiles dynamically loaded modules with CPAN::Shell->recompile.
-t  -- Runs a `make test` on the specified modules.
-v  -- Print the script version and CPAN.pm version.