| 1 | #!perl | ||
| 2 | 21 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 21 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 21 | ▶ | use OptArgs2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | our $VERSION = '1.0.1'; | ||
| 7 | |||
| 8 | cmd 'App::githook::perltidy' => ( | ||
| 9 | name => 'githook-perltidy', | ||
| 10 | comment => 'tidy perl and pod files before Git commits', | ||
| 11 | optargs => [ | ||
| 12 | command => { | ||
| 13 | isa => 'SubCmd', | ||
| 14 | comment => '', | ||
| 15 | required => 1, | ||
| 16 | }, | ||
| 17 | verbose => { | ||
| 18 | isa => '--Flag', | ||
| 19 | comment => 'be explicit about underlying actions', | ||
| 20 | alias => 'v', | ||
| 21 | 11 | ▶ | default => sub { $ENV{GITHOOK_PERLTIDY_VERBOSE} }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 22 | }, | ||
| 23 | version => { | ||
| 24 | isa => '--Flag', | ||
| 25 | comment => 'print version and exit', | ||
| 26 | alias => 'V', | ||
| 27 | 0 | ▶ | trigger => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 28 | 0 | require File::Basename; | |
| 29 | 0 | die File::Basename::basename($0) | |
| 30 | . ' version ' | ||
| 31 | . $VERSION . "\n"; | ||
| 32 | }, | ||
| 33 | }, | ||
| 34 | ], | ||
| 35 | ); | ||
| 36 | |||
| 37 | subcmd 'App::githook::perltidy::install' => ( | ||
| 38 | comment => 'install a Git pre-commit hook', | ||
| 39 | optargs => [ | ||
| 40 | absolute => { | ||
| 41 | isa => '--Flag', | ||
| 42 | comment => 'Use full path to script in hook', | ||
| 43 | alias => 'a', | ||
| 44 | }, | ||
| 45 | force => { | ||
| 46 | isa => '--Flag', | ||
| 47 | comment => 'Overwrite existing git commit hooks', | ||
| 48 | alias => 'f', | ||
| 49 | }, | ||
| 50 | ], | ||
| 51 | ); | ||
| 52 | |||
| 53 | subcmd 'App::githook::perltidy::pre_commit' => | ||
| 54 | ( comment => 'tidy Perl and POD files in the Git index', ); | ||
| 55 | |||
| 56 | my ( $class, $opts, $file ) = class_optargs('App::githook::perltidy'); | ||
| 57 | require $file; | ||
| 58 | $class->new($opts)->run; | ||
| 59 | |||
| 60 | 1; | ||
| 61 | __END__ | ||