| 1 | use v5.38; | ||
| 2 | use feature 'class'; | ||
| 3 | no warnings 'experimental::class'; | ||
| 4 | |||
| 5 | use Pod::Usage (); | ||
| 6 | use Pod::Find (); | ||
| 7 | |||
| 8 | class CPANSEC::Admin::Command::Help { | ||
| 9 | method name { 'help' } | ||
| 10 | |||
| 11 | method command ($manager, $cmd_name = undef, @args) { | ||
| 12 | my %params; | ||
| 13 | if ($cmd_name) { | ||
| 14 | my %dispatcher = $manager->dispatcher; | ||
| 15 | if (exists $dispatcher{$cmd_name}) { | ||
| 16 | if (my $loc = Pod::Find::pod_where({-inc => 1}, ref $dispatcher{$cmd_name})) { | ||
| 17 | $params{'-input'} = $loc; | ||
| 18 | %params = ( | ||
| 19 | -sections => 'USAGE|SYNOPSIS|DESCRIPTION|ARGUMENTS', | ||
| 20 | -verbose => 99, | ||
| 21 | -input => $loc, | ||
| 22 | ); | ||
| 23 | } | ||
| 24 | else { | ||
| 25 | $params{'-message'} = "no documentation found for command '$cmd_name'.\n"; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | else { | ||
| 29 | $params{'-message'} = "command '$cmd_name' not found.\n"; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | $params{'-input'} = Pod::Find::pod_where({-inc => 1}, $0) unless $params{'-input'}; | ||
| 33 | Pod::Usage::pod2usage(%params); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | __END__ |