diff mbox series

[RFC,2/2] scancpan: wrap abstract if too long

Message ID 20180813131135.32651-3-chrismcc@gmail.com
State Changes Requested
Headers show
Series scancpan patches | expand

Commit Message

Christopher McCrory Aug. 13, 2018, 1:11 p.m. UTC
Signed-off-by: Christopher McCrory <chrismcc@gmail.com>
---
 utils/scancpan | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Francois Perrad Aug. 13, 2018, 4:29 p.m. UTC | #1
2018-08-13 15:11 GMT+02:00 Christopher McCrory <chrismcc@gmail.com>:

> Signed-off-by: Christopher McCrory <chrismcc@gmail.com>
> ---
>  utils/scancpan | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/utils/scancpan b/utils/scancpan
> index 2070e2a233..f8411079e1 100755
> --- a/utils/scancpan
> +++ b/utils/scancpan
> @@ -484,6 +484,8 @@ use HTTP::Tiny;
>  use Safe;
>  use MetaCPAN::API::Tiny;
>  use Digest::SHA qw(sha256_hex);
> +use Text::Wrap;
>

Ok, Text::Wrap is a core module, so the script scancpan stays self-depend.

>
> +$Text::Wrap::columns = 70;
>
>  # Below, 5.026 should be aligned with the version of perl actually
>  # bundled in Buildroot:
> @@ -655,7 +657,7 @@ while (my ($distname, $dist) = each %dist) {
>      my $brname = brname( $fsname );
>      mkdir $dirname unless -d $dirname;
>      if ($need_target{$distname} && ($force || !-f $cfgname)) {
> -        my $abstract = $dist->{abstract};
> +        my $abstract = wrap("","\t  ",$dist->{abstract});
>

In this script, I don't use quote but q{} and qq{}.
And I put one space after comma.

François


>          my $homepage = $dist->{resources}->{homepage} || qq{
> https://metacpan.org/release/${distname}};
>          say qq{write ${cfgname}} unless $quiet;
>          open my $fh, q{>}, $cfgname;
> --
> 2.14.4
>
>
<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-08-13 15:11 GMT+02:00 Christopher McCrory <span dir="ltr">&lt;<a href="mailto:chrismcc@gmail.com" target="_blank">chrismcc@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Christopher McCrory &lt;<a href="mailto:chrismcc@gmail.com">chrismcc@gmail.com</a>&gt;<br>
---<br>
 utils/scancpan | 4 +++-<br>
 1 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/utils/scancpan b/utils/scancpan<br>
index 2070e2a233..f8411079e1 100755<br>
--- a/utils/scancpan<br>
+++ b/utils/scancpan<br>
@@ -484,6 +484,8 @@ use HTTP::Tiny;<br>
 use Safe;<br>
 use MetaCPAN::API::Tiny;<br>
 use Digest::SHA qw(sha256_hex);<br>
+use Text::Wrap;<br></blockquote><div><br></div><div>Ok, Text::Wrap is a core module, so the script scancpan stays self-depend.</div> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+$Text::Wrap::columns = 70;<br>
<br>
 # Below, 5.026 should be aligned with the version of perl actually<br>
 # bundled in Buildroot:<br>
@@ -655,7 +657,7 @@ while (my ($distname, $dist) = each %dist) {<br>
     my $brname = brname( $fsname );<br>
     mkdir $dirname unless -d $dirname;<br>
     if ($need_target{$distname} &amp;&amp; ($force || !-f $cfgname)) {<br>
-        my $abstract = $dist-&gt;{abstract};<br>
+        my $abstract = wrap(&quot;&quot;,&quot;\t  &quot;,$dist-&gt;{abstract});<br></blockquote><div><br></div><div>In this script, I don&#39;t use quote but q{} and qq{}.</div><div>And I put one space after comma.<br></div><div><br></div><div>François<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
         my $homepage = $dist-&gt;{resources}-&gt;{homepage} || qq{<a href="https://metacpan.org/release/${distname}" rel="noreferrer" target="_blank">https://metacpan.org/<wbr>release/${distname}</a>};<br>
         say qq{write ${cfgname}} unless $quiet;<br>
         open my $fh, q{&gt;}, $cfgname;<br>
<span class="gmail-HOEnZb"><font color="#888888">-- <br>
2.14.4<br>
<br>
</font></span></blockquote></div><br></div></div>
Ricardo Martincoski Aug. 16, 2018, 3:07 a.m. UTC | #2
Hello,

On Mon, Aug 13, 2018 at 10:11 AM, Christopher McCrory wrote:

> +++ b/utils/scancpan
> @@ -484,6 +484,8 @@ use HTTP::Tiny;
>  use Safe;
>  use MetaCPAN::API::Tiny;
>  use Digest::SHA qw(sha256_hex);
> +use Text::Wrap;
> +$Text::Wrap::columns = 70;

Please use 62 instead of 70 here ...

>  
>  # Below, 5.026 should be aligned with the version of perl actually
>  # bundled in Buildroot:
> @@ -655,7 +657,7 @@ while (my ($distname, $dist) = each %dist) {
>      my $brname = brname( $fsname );
>      mkdir $dirname unless -d $dirname;
>      if ($need_target{$distname} && ($force || !-f $cfgname)) {
> -        my $abstract = $dist->{abstract};
> +        my $abstract = wrap("","\t  ",$dist->{abstract});

... so the help text generated here always fits in:
<tab><2 spaces><62 chars>
"tab counts for 8" as described in:
http://nightly.buildroot.org/#writing-rules-config-in

>          my $homepage = $dist->{resources}->{homepage} || qq{https://metacpan.org/release/${distname}};
>          say qq{write ${cfgname}} unless $quiet;
>          open my $fh, q{>}, $cfgname;
> -- 

Regards,
Ricardo
diff mbox series

Patch

diff --git a/utils/scancpan b/utils/scancpan
index 2070e2a233..f8411079e1 100755
--- a/utils/scancpan
+++ b/utils/scancpan
@@ -484,6 +484,8 @@  use HTTP::Tiny;
 use Safe;
 use MetaCPAN::API::Tiny;
 use Digest::SHA qw(sha256_hex);
+use Text::Wrap;
+$Text::Wrap::columns = 70;
 
 # Below, 5.026 should be aligned with the version of perl actually
 # bundled in Buildroot:
@@ -655,7 +657,7 @@  while (my ($distname, $dist) = each %dist) {
     my $brname = brname( $fsname );
     mkdir $dirname unless -d $dirname;
     if ($need_target{$distname} && ($force || !-f $cfgname)) {
-        my $abstract = $dist->{abstract};
+        my $abstract = wrap("","\t  ",$dist->{abstract});
         my $homepage = $dist->{resources}->{homepage} || qq{https://metacpan.org/release/${distname}};
         say qq{write ${cfgname}} unless $quiet;
         open my $fh, q{>}, $cfgname;