Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qYRsq-001jgc-8O for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Aug 2023 13:57:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qYRso-001iXl-MD for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Aug 2023 13:57:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qYRso-001iXd-Bh for pgsql-hackers@lists.postgresql.org; Tue, 22 Aug 2023 13:57:22 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qYRsj-000NTq-IQ for pgsql-hackers@postgresql.org; Tue, 22 Aug 2023 13:57:21 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 11902609D4; Tue, 22 Aug 2023 22:57:07 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 22 Aug 2023 22:57:07 +0900 From: torikoshia To: Masahiro Ikeda Cc: Pgsql Hackers Subject: Re: Make --help output fit within 80 columns per line In-Reply-To: <3965013067e7b6195132da6c0b80a609@oss.nttdata.com> References: <50ca8ff35a8dd8f9ec89963b503571a7@oss.nttdata.com> <3965013067e7b6195132da6c0b80a609@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <70043684388c1a8d181cf8f3308ad3ec@oss.nttdata.com> X-Sender: torikoshia@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-08-21 13:08, Masahiro Ikeda wrote: Thanks for your review! > (1) > > Why don't you add test for the purpose? It could be overkill... > I though the following function is the best place. > > diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm > b/src/test/perl/PostgreSQL/Test/Utils.pm > index 617caa022f..1bdb81ac56 100644 > --- a/src/test/perl/PostgreSQL/Test/Utils.pm > +++ b/src/test/perl/PostgreSQL/Test/Utils.pm > @@ -843,6 +843,10 @@ sub program_help_ok > ok($result, "$cmd --help exit code 0"); > isnt($stdout, '', "$cmd --help goes to stdout"); > is($stderr, '', "$cmd --help nothing to stderr"); > + foreach my $line (split /\n/, $stdout) > + { > + ok(length($line) <= 80, "$cmd --help output fit within > 80 columns per line"); > + } > return; > } Agreed. > (2) > > Is there any reason that only src/bin commands are targeted? I found > that > we also need to fix vacuumlo with the above test. I think it's better > to > fix it because it's a contrib module. > > $ vacuumlo --help | while IFS='' read line; do echo $((`echo $line | > wc -m` - 1)) $line; done | sort -n -r | head -n 2 > 84 -n, --dry-run don't remove large objects, just show > what would be done > 74 -l, --limit=LIMIT commit after removing each LIMIT large > objects This is because I wasn't sure making all --help outputs fit into 80 columns per line is right thing to do as described below: | If this is the way to go, I'll do same things for contrib commands. If there are no objection, I'm going to make other commands fit within 80 columns per line including (4). > (3) > > Is to delete '/mnt/server' intended? I though it better to leave it as > is since archive_cleanup_command example uses the absolute path. > > - " pg_archivecleanup /mnt/server/archiverdir > 000000010000000000000010.00000020.backup\n")); > + " pg_archivecleanup archiverdir > 000000010000000000000010.00000020.backup\n")); > > I will confirmed that the --help text are not changed and only > the line breaks are changed. But, currently the above change > break it. Yes, it is intended as described in the thread. https://www.postgresql.org/message-id/20230615.152036.1556630042388070221.horikyota.ntt%40gmail.com | We could shorten it by removing the "/mnt/server" portion, but I'm not sure if it's worth doing. However, I feel it is acceptable to make an exception and exceed 80 characters for this line. > (4) > > I found that some binaries, for example ecpg, are not tested with > program_help_ok(). Is it better to add tests in the patch? > Agreed. > BTW, I check the difference with the following commands > # files include "--help" > $ find -name "*.c" | xargs -I {} sh -c 'if [ `grep -e --help {} | wc > -l` -gt 0 ]; then echo {}; fi' > > # programs which is tested with program_help_ok > $ find -name "*.pl" | xargs -I {} sh -c 'grep -e program_help_ok {}' Thanks for sharing your procedure! -- Regards, -- Atsushi Torikoshi NTT DATA Group Corporation