#!perl # Note: This script is a CLI for Riap function /App/CPANChangesUtils/parse_cpan_changes # and generated automatically using Perinci::CmdLine::Gen version 0.501 use 5.010001; use strict; use warnings; use Log::ger; use Perinci::CmdLine::Any; our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY our $DATE = '2022-06-13'; # DATE our $DIST = 'App-CPANChangesUtils'; # DIST our $VERSION = '0.077'; # VERSION my $cmdline = Perinci::CmdLine::Any->new( url => "/App/CPANChangesUtils/parse_cpan_changes", program_name => "parse-cpan-changes", log => 1, read_config => 0, read_env => 0, ); $cmdline->run; # ABSTRACT: Parse CPAN Changes file # PODNAME: parse-cpan-changes __END__ =pod =encoding UTF-8 =head1 NAME parse-cpan-changes - Parse CPAN Changes file =head1 VERSION This document describes version 0.077 of parse-cpan-changes (from Perl distribution App-CPANChangesUtils), released on 2022-06-13. =head1 SYNOPSIS % B<parse-cpan-changes> [B<--class>=I<perl::modname>] [B<--debug>|B<--log-level>=I<level>|B<--quiet>|B<--trace>|B<--verbose>] [B<--format>=I<name>|B<--json>] [B<--(no)naked-res>] [B<--page-result>[=I<program>]|B<--view-result>[=I<program>]] [B<--parse-release-metadata>|B<--no-parse-release-metadata>|B<--noparse-release-metadata>] [B<--unbless>|B<--no-unbless>|B<--nounbless>] -- [I<file>] See examples in the L</EXAMPLES> section. =head1 DESCRIPTION This utility is a simple wrapper for L<CPAN::Changes>. =head1 OPTIONS C<*> marks required options. =head2 Main options =over =item B<--class>=I<s> Default value: "CPAN::Changes" =item B<--file>=I<s> If not specified, will look for file called Changes/ChangeLog in current directory. Can also be specified as the 1st command-line argument. =item B<--no-parse-release-metadata> If set to true (the default), the utility will attempt to parse release metadata in the release note. The release note is the text after the version and date in the first line of a release entry: 0.001 - 2022-06-10 THIS IS THE RELEASE NOTE AND CAN BE ANY TEXT One convention I use is for the release note to be semicolon-separated of metadata entries, where each metadata is in the form of HTTP-header-like "Name: Value" text where Name is dash-separated words and Value is any text that does not contain newline or semicolon. Example: 0.001 - 2022-06-10 Urgency: high; Backward-Incompatible: yes Note that Debian changelog also supports "key=value" in the release line. This option, when enabled, will first check if the release note is indeed in the form of semicolon-separated metadata. If yes, will create a key called C<metadata> in the release result structure containing a hash of metadata: { "urgency" => "high", "backward-incompatible" => "yes" } Note that the metadata names are converted to lowercase. =item B<--no-unbless> If you set this to false, you'll need to use an output format that can handle serializing Perl objects, e.g. on the CLI using C<--format=perl>. =back =head2 Logging options =over =item B<--debug> Shortcut for --log-level=debug. =item B<--log-level>=I<s> Set log level. By default, these log levels are available (in order of increasing level of importance, from least important to most): C<trace>, C<debug>, C<info>, C<warn>/C<warning>, C<error>, C<fatal>. By default, the level is usually set to C<warn>, which means that log statements with level C<info> and less important levels will not be shown. To increase verbosity, choose C<info>, C<debug>, or C<fatal>. For more details on log level and logging, as well as how new logging levels can be defined or existing ones modified, see L<Log::ger>. =item B<--quiet> Shortcut for --log-level=error. =item B<--trace> Shortcut for --log-level=trace. =item B<--verbose> Shortcut for --log-level=info. =back =head2 Output options =over =item B<--format>=I<s> Choose output format, e.g. json, text. Default value: undef Output can be displayed in multiple formats, and a suitable default format is chosen depending on the application and/or whether output destination is interactive terminal (i.e. whether output is piped). This option specifically chooses an output format. =item B<--json> Set output format to json. =item B<--naked-res> When outputing as JSON, strip result envelope. Default value: 0 By default, when outputing as JSON, the full enveloped result is returned, e.g.: [200,"OK",[1,2,3],{"func.extra"=>4}] The reason is so you can get the status (1st element), status message (2nd element) as well as result metadata/extra result (4th element) instead of just the result (3rd element). However, sometimes you want just the result, e.g. when you want to pipe the result for more post-processing. In this case you can use C<--naked-res> so you just get: [1,2,3] =item B<--page-result> Filter output through a pager. This option will pipe the output to a specified pager program. If pager program is not specified, a suitable default e.g. C<less> is chosen. =item B<--view-result> View output using a viewer. This option will first save the output to a temporary file, then open a viewer program to view the temporary file. If a viewer program is not chosen, a suitable default, e.g. the browser, is chosen. =back =head2 Other options =over =item B<--help>, B<-h>, B<-?> Display help message and exit. =item B<--version>, B<-v> Display program's version and exit. =back =head1 COMPLETION This script has shell tab completion capability with support for several shells. =head2 bash To activate bash completion for this script, put: complete -C parse-cpan-changes parse-cpan-changes in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately. It is recommended, however, that you install modules using L<cpanm-shcompgen> which can activate shell completion for scripts immediately. =head2 tcsh To activate tcsh completion for this script, put: complete parse-cpan-changes 'p/*/`parse-cpan-changes`/' in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately. It is also recommended to install L<shcompgen> (see above). =head2 other shells For fish and zsh, install L<shcompgen> as described above. =head1 EXAMPLES =head2 Parse with default settings % parse-cpan-changes [ 200, "OK", { "months" : { "Apr" : 4, "Aug" : 8, "Dec" : 12, "Feb" : 2, "Jan" : 1, "Jul" : 7, "Jun" : 6, "Mar" : 3, "May" : 5, "Nov" : 11, "Oct" : 10, "Sep" : 9 }, "preamble" : "", "releases" : { "0.01" : { "_parsed_date" : "2013-08-05", "changes" : { "" : { "changes" : [ "First version." ], "name" : "" } }, "date" : "2013-08-05", "metadata" : { "released-by" : "SHARYANTO" }, "note" : "Released-By: SHARYANTO", "version" : "0.01" }, "0.02" : { "_parsed_date" : "2013-08-06", "changes" : { "" : { "changes" : [ "No functional changes. Add missing dep [CT]." ], "name" : "" } }, "date" : "2013-08-06", "metadata" : { "released-by" : "SHARYANTO" }, "note" : "Released-By: SHARYANTO", "version" : "0.02" }, "0.03" : { "_parsed_date" : "2013-11-01", "changes" : { "" : { "changes" : [ "No functional changes. Mention some other modules and the rationale for the script." ], "name" : "" } }, "date" : "2013-11-01", "metadata" : { "released-by" : "SHARYANTO" }, "note" : "Released-By: SHARYANTO", "version" : "0.03" }, "0.04" : { "_parsed_date" : "2014-07-22", "changes" : { "" : { "changes" : [ "No functional changes.", "Switch CLI scripts from using Perinci::CmdLine to Perinci::CmdLine::Any to reduce size of dependencies." ], "name" : "" } }, "date" : "2014-07-22", "metadata" : { "released-by" : "SHARYANTO" }, "note" : "Released-By: SHARYANTO", "version" : "0.04" }, "0.05" : { "_parsed_date" : "2015-09-03", "changes" : { "" : { "changes" : [ "No functional changes.", "[dist] Move spec prereqs from RuntimeRequires to DevelopRecommends to reduce deps but still allow indicating spec requirement." ], "name" : "" } }, "date" : "2015-09-03", "metadata" : { "released-by" : "PERLANCAR" }, "note" : "Released-By: PERLANCAR", "version" : "0.05" }, "0.06" : { "_parsed_date" : "2016-01-18", "changes" : { "" : { "changes" : [ "No functional changes.", "[build] Rebuild to fix POD section ordering." ], "name" : "" } }, "date" : "2016-01-18", "metadata" : { "released-by" : "PERLANCAR" }, "note" : "Released-By: PERLANCAR", "version" : "0.06" }, "0.070" : { "_parsed_date" : "2019-07-03", "changes" : { "" : { "changes" : [ "Add option --class to customize parser class." ], "name" : "" } }, "date" : "2019-07-03", "metadata" : { "released-by" : "PERLANCAR", "urgency" : "medium" }, "note" : "Released-By: PERLANCAR; Urgency: medium", "version" : "0.070" }, "0.071" : { "_parsed_date" : "2020-10-06", "changes" : { "" : { "changes" : [ "Add option --no-unbless." ], "name" : "" } }, "date" : "2020-10-06", "metadata" : { "released-by" : "PERLANCAR", "urgency" : "medium" }, "note" : "Released-By: PERLANCAR; Urgency: medium", "version" : "0.071" }, "0.072" : { "_parsed_date" : "2021-05-25", "changes" : { "" : { "changes" : [ "[build] Rebuild to update Sah coercion module names (old Sah coercion modules have been purged from CPAN)." ], "name" : "" } }, "date" : "2021-05-25", "metadata" : { "released-by" : "PERLANCAR", "urgency" : "high" }, "note" : "Released-By: PERLANCAR; Urgency: high", "version" : "0.072" }, "0.073" : { "_parsed_date" : "2021-10-17", "changes" : { "" : { "changes" : [ "Rename module/dist App-ParseCPANChanges -> App-CPANChangesUtils. - Add CLI format-cpan-changes." ], "name" : "" } }, "date" : "2021-10-17", "metadata" : { "released-by" : "PERLANCAR", "urgency" : "medium" }, "note" : "Released-By: PERLANCAR; Urgency: medium", "version" : "0.073" }, "0.075" : { "_parsed_date" : "2022-06-10", "changes" : { "" : { "changes" : [ "[utility parse-cpan-changes] Add option parse_release_metadata (defaults to true) to parse 'key: value' metadata in the release note." ], "name" : "" } }, "date" : "2022-06-10", "metadata" : { "released-by" : "PERLANCAR", "urgency" : "medium" }, "note" : "Released-By: PERLANCAR; Urgency: medium", "version" : "0.075" }, "0.076" : { "_parsed_date" : "2022-06-10", "changes" : { "" : { "changes" : [ "No functional changes.", "[ux] Add an example." ], "name" : "" } }, "date" : "2022-06-10", "metadata" : { "released-by" : "PERLANCAR", "urgency" : "low" }, "note" : "Released-By: PERLANCAR; Urgency: low", "version" : "0.076" }, "0.077" : { "_parsed_date" : "2022-06-13", "changes" : { "" : { "changes" : [ "No functional changes.", "[ux] Show content of Changes file in example." ], "name" : "" } }, "date" : "2022-06-13", "metadata" : { "released-by" : "PERLANCAR", "urgency" : "low" }, "note" : "Released-By: PERLANCAR; Urgency: low", "version" : "0.077" } } }, {} ] Content of C<Changes> file: 0.076 2022-06-10 Released-By: PERLANCAR; Urgency: low - No functional changes. - [ux] Add an example. 0.075 2022-06-10 Released-By: PERLANCAR; Urgency: medium - [utility parse-cpan-changes] Add option parse_release_metadata (defaults to true) to parse 'key: value' metadata in the release note. 0.073 2021-10-17 Released-By: PERLANCAR; Urgency: medium - Rename module/dist App-ParseCPANChanges -> App-CPANChangesUtils. - Add CLI format-cpan-changes. 0.072 2021-05-25 Released-By: PERLANCAR; Urgency: high - [build] Rebuild to update Sah coercion module names (old Sah coercion modules have been purged from CPAN). 0.071 2020-10-06 Released-By: PERLANCAR; Urgency: medium - Add option --no-unbless. 0.070 2019-07-03 Released-By: PERLANCAR; Urgency: medium - Add option --class to customize parser class. 0.06 2016-01-18 Released-By: PERLANCAR - No functional changes. - [build] Rebuild to fix POD section ordering. 0.05 2015-09-03 Released-By: PERLANCAR - No functional changes. - [dist] Move spec prereqs from RuntimeRequires to DevelopRecommends to reduce deps but still allow indicating spec requirement. 0.04 2014-07-22 Released-By: SHARYANTO - No functional changes. - Switch CLI scripts from using Perinci::CmdLine to Perinci::CmdLine::Any to reduce size of dependencies. 0.03 2013-11-01 Released-By: SHARYANTO - No functional changes. Mention some other modules and the rationale for the script. 0.02 2013-08-06 Released-By: SHARYANTO - No functional changes. Add missing dep [CT]. 0.01 2013-08-05 Released-By: SHARYANTO - First version. =head1 HOMEPAGE Please visit the project's homepage at L<https://metacpan.org/release/App-CPANChangesUtils>. =head1 SOURCE Source repository is at L<https://github.com/perlancar/perl-App-CPANChangesUtils>. =head1 AUTHOR perlancar <perlancar@cpan.org> =head1 CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install L<Dist::Zilla>, L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022, 2021 by perlancar <perlancar@cpan.org>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-CPANChangesUtils> When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =cut