Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add showconfig command #225

Merged
merged 8 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>


- Add menuButtonSet and menuLabel to Actions.js to allow
separate config of mobile and regular menus
- Translate tooltip and placeholder in Card.js
Expand Down
2 changes: 2 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/CallBackery.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
81 changes: 81 additions & 0 deletions lib/CallBackery/Command/showconfig.pm
Original file line number Diff line number Diff line change
@@ -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<showconfig> [--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

S<Fritz Zaucker E<lt>[email protected]<gt>>

=head1 HISTORY

2024-02-19 fz Initial

=cut
2 changes: 1 addition & 1 deletion lib/CallBackery/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading