| 1 | package P5U::Command::About; | ||
| 2 | |||
| 3 | use 5.010; | ||
| 4 | use strict; | ||
| 5 | use utf8; | ||
| 6 | use P5U-command; | ||
| 7 | |||
| 8 | BEGIN { | ||
| 9 | $P5U::Command::About::AUTHORITY = 'cpan:TOBYINK'; | ||
| 10 | $P5U::Command::About::VERSION = '0.100'; | ||
| 11 | }; | ||
| 12 | |||
| 13 | use constant { | ||
| 14 | abstract => q[list which P5U plugins are installed], | ||
| 15 | usage_desc => q[%c about], | ||
| 16 | }; | ||
| 17 | |||
| 18 | use constant FORMAT_STR => "%-30s%10s %s\n"; | ||
| 19 | |||
| 20 | sub command_names | ||
| 21 | { | ||
| 22 | qw( | ||
| 23 | about | ||
| 24 | credits | ||
| 25 | ); | ||
| 26 | } | ||
| 27 | |||
| 28 | sub opt_spec | ||
| 29 | { | ||
| 30 | return; | ||
| 31 | } | ||
| 32 | |||
| 33 | sub execute | ||
| 34 | { | ||
| 35 | my ($self, $opt, $args) = @_; | ||
| 36 | |||
| 37 | my $auth = $self->app->can('AUTHORITY'); | ||
| 38 | printf( | ||
| 39 | FORMAT_STR, | ||
| 40 | ref($self->app), | ||
| 41 | $self->app->VERSION, | ||
| 42 | $auth ? $self->app->$auth : '???', | ||
| 43 | ); | ||
| 44 | |||
| 45 | foreach my $cmd (sort $self->app->command_plugins) | ||
| 46 | { | ||
| 47 | my $auth = $cmd->can('AUTHORITY'); | ||
| 48 | printf( | ||
| 49 | FORMAT_STR, | ||
| 50 | $cmd, | ||
| 51 | $cmd->VERSION, | ||
| 52 | $auth ? $cmd->$auth : '???', | ||
| 53 | ); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | 1; |