diff --git a/CHANGES b/CHANGES index b7407e0..78174c0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ + + - Add command showconfig to show print pod from Config.pm + 0.49.1 2024-02-19 14:50:15 +0100 Tobias Oetiker + - Add menuButtonSet and menuLabel to Actions.js to allow separate config of mobile and regular menus - Translate tooltip and placeholder in Card.js diff --git a/Makefile.PL b/Makefile.PL index 6bc764b..09afd55 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -24,6 +24,8 @@ WriteMakefile( 'Text::CSV' => 0, 'Excel::Writer::XLSX' => 0, 'Test::Fatal' => 0, + 'Pod::Simple::Text' => 0, + 'Pod::Simple::HTML' => 0, }, BUILD_REQUIRES => { 'CPAN::Uploader' => 0 diff --git a/lib/CallBackery.pm b/lib/CallBackery.pm index 4aa18c0..5fc12e9 100644 --- a/lib/CallBackery.pm +++ b/lib/CallBackery.pm @@ -143,6 +143,9 @@ sub startup { } } + ## commands + unshift @{$app->commands->namespaces}, __PACKAGE__.'::Command'; + unshift @{$app->static->paths}, $app->home->rel_file('frontend').'/compiled/source/' if $app->mode eq 'development'; # Router diff --git a/lib/CallBackery/Command/showconfig.pm b/lib/CallBackery/Command/showconfig.pm new file mode 100644 index 0000000..f21eb3f --- /dev/null +++ b/lib/CallBackery/Command/showconfig.pm @@ -0,0 +1,81 @@ +package CallBackery::Command::showconfig; + +use Mojo::Base 'Mojolicious::Command', -signatures; +use Getopt::Long qw(GetOptionsFromArray :config no_auto_abbrev no_ignore_case); +use Pod::Usage; +use Pod::Simple::Text; +use Pod::Simple::HTML; + +has description => "showconfig\n"; +has usage => <<"EOF"; +Usage: $0 showconfig [options] + + --verbose + --help + --html output as html + +EOF + +my %opt; + +sub run ($self, @args) { + my $app = $self->app; + + GetOptionsFromArray \@args, \%opt,qw(help verbose html) or exit 1; + + $app->log->level($opt{verbose} ? 'debug' : 'info'); + + if ($opt{help}) { die $self->usage } + + $opt{html} ? Pod::Simple::HTML->filter(\$app->config->pod) + : Pod::Simple::Text->filter(\$app->config->pod); + + + return; +} + +1; + +__END__ + +=head1 NAME + +showconfig - show config documentation as pod + +=head1 SYNOPSIS + +APPLICATION B [--verbose] [--help] [--html] + +=head1 DESCRIPTION + +Parse the .cfg file definition and output documentation as pod + +=head1 COPYRIGHT + +Copyright (c) 2024- by OETIKER+PARTNER AG. All rights reserved. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +=head1 AUTHOR + +Sfritz.zaucker@oetiker.chE> + +=head1 HISTORY + + 2024-02-19 fz Initial + +=cut diff --git a/lib/CallBackery/Config.pm b/lib/CallBackery/Config.pm index 27dddf2..83f8351 100644 --- a/lib/CallBackery/Config.pm +++ b/lib/CallBackery/Config.pm @@ -100,7 +100,7 @@ FOOTER my $header = <<"HEADER"; ${E}head1 NAME -callbackery.cfg - The Apliance FRONTEND Builder config file +callbackery.cfg - The Appliance FRONTEND Builder config file ${E}head1 SYNOPSIS