Dist::Zilla::Plugin::GenShellCompletion - Generate shell completion scripts when distribution is installed


This document describes version 0.11 of Dist::Zilla::Plugin::GenShellCompletion (from Perl distribution Dist-Zilla-Plugin-GenShellCompletion), released on 2016-04-20.


In your dist.ini:



This plugin modifies Makefile.PL so that when a user installs your distribution with make install, shcompgen is invoked to generate shell completion scripts for your scripts. This is convenient because immediately after the user installs your distribution, shell tab completion is already activated for your scripts.

shcompgen recognizes several ways/hints to generate completion to your scripts. Please see its documentation for more details.

Some notes:

First, user must already install and setup shcompgen prior to installing your distribution. But if shcompgen is installed after your distribution is installed, she can simply run shcompgen generate to scan PATH and generate completion for all recognized programs, including yours.

Second, this plugin's implementation strategy is currently as follow (probably hackish): insert some code in the generated Makefile.PL after WriteMakefile() to insert some targets in the Makefile generated by Makefile.PL.

Third, currently only MakeMaker is supported, Module::Build is not.


Please visit the project's homepage at


Source repository is at


Please report any bugs or feature requests on the bugtracker website

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.



CLI scripts using the Perinci::CmdLine framework will automatically have shell tab completion capability. shcompgen detects this.

You can also use Getopt::Long::Complete or Getopt::Long::Subcommand. shcompgen also detects this.


perlancar <>


This software is copyright (c) 2016 by

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.