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 1qhATQ-001XDl-Ut for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Sep 2023 15:11:12 +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 1qhATO-000tdC-MM for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Sep 2023 15:11:10 +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 1qhATO-000tcz-Ag for pgsql-hackers@lists.postgresql.org; Fri, 15 Sep 2023 15:11:10 +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 1qhATK-005Gsk-Bd for pgsql-hackers@postgresql.org; Fri, 15 Sep 2023 15:11:09 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id D3CD8605CA; Sat, 16 Sep 2023 00:10:59 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at oss.nttdata.com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_f8c1c73852b5022f7fcf225c5123a8e3" Content-Transfer-Encoding: 7bit Date: Sat, 16 Sep 2023 00:10:59 +0900 From: torikoshia To: Greg Sabino Mullane , peter@eisentraut.org Cc: Pgsql Hackers Subject: Re: Make --help output fit within 80 columns per line In-Reply-To: References: <50ca8ff35a8dd8f9ec89963b503571a7@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <625cf9ca9bd93b93e3e40dafb88ca62a@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 --=_f8c1c73852b5022f7fcf225c5123a8e3 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 2023-09-12 15:27, Peter Eisentraut wrote: > Also, it would be very useful if the TAP test function could print out > the violating lines if a test fails. (Similar to how is() and like() > print the failing values.) Attached patch for this. Below are the the outputs when test failed: ``` $ cd contrib/vacuumlo $ make check ...(snip)... t/001_basic.pl .. 1/? # Failed test ' -n, --dry-run don't remove large objects, just show what would be done' # at /home/atorik/postgres/contrib/vacuumlo/../../src/test/perl/PostgreSQL/Test/Utils.pm line 850. # Looks like you failed 1 test of 21. # Failed test 'vacuumlo --help outputs fit within 80 columns per line' # at t/001_basic.pl line 10. # Looks like you failed 1 test of 9. t/001_basic.pl .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/9 subtests Test Summary Report ------------------- t/001_basic.pl (Wstat: 256 (exited 1) Tests: 9 Failed: 1) Failed test: 4 Non-zero exit status: 1 Files=1, Tests=9, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.04 cusr 0.01 csys = 0.07 CPU) Result: FAIL ``` ``` $ cat tmp_check/log/regress_log_001_basic # Running: vacuumlo --help [23:11:10.378](0.230s) ok 1 - vacuumlo --help exit code 0 [23:11:10.379](0.001s) ok 2 - vacuumlo --help goes to stdout [23:11:10.379](0.000s) ok 3 - vacuumlo --help nothing to stderr [23:11:10.380](0.000s) # Subtest: vacuumlo --help outputs fit within 80 columns per line [23:11:10.380](0.001s) ok 1 - vacuumlo removes unreferenced large objects from databases. [23:11:10.380](0.000s) ok 2 - [23:11:10.381](0.000s) ok 3 - Usage: [23:11:10.381](0.000s) ok 4 - vacuumlo [OPTION]... DBNAME... [23:11:10.381](0.000s) ok 5 - [23:11:10.381](0.000s) ok 6 - Options: [23:11:10.381](0.000s) ok 7 - -l, --limit=LIMIT commit after removing each LIMIT large objects [23:11:10.382](0.000s) ok 20 - Report bugs to . [23:11:10.382](0.000s) ok 21 - PostgreSQL home page: [23:11:10.382](0.000s) 1..21 [23:11:10.382](0.000s) # Looks like you failed 1 test of 21. [23:11:10.382](0.000s) not ok 4 - vacuumlo --help outputs fit within 80 columns per line [23:11:10.382](0.000s) [23:11:10.382](0.000s) # Failed test 'vacuumlo --help outputs fit within 80 columns per line' # at t/001_basic.pl line 10. # Running: vacuumlo --version [23:11:10.388](0.005s) ok 5 - vacuumlo --version exit code 0 [23:11:10.388](0.000s) ok 6 - vacuumlo --version goes to stdout [23:11:10.388](0.000s) ok 7 - vacuumlo --version nothing to stderr # Running: vacuumlo --not-a-valid-option [23:11:10.391](0.003s) ok 8 - vacuumlo with invalid option nonzero exit code [23:11:10.391](0.000s) ok 9 - vacuumlo with invalid option prints error message [23:11:10.391](0.000s) 1..9 [23:11:10.391](0.000s) # Looks like you failed 1 test of 9. ``` I feel using subtest in Test::More improves readability. On 2023-09-14 02:46, Greg Sabino Mullane wrote: > All this seems an awful lot of work to support this mythical 80-column > terminal user. > It's 2023, perhaps it's time to widen the default assumption past 80 > characters? That may be a good idea. However, from what I have seen some basic commands like `ls` in my Linux environments, the man command has over 100 characters per line, while the output of the --help option seems to be within 80 characters per line. Also, the current PostgreSQL commands follow the "no more than 80 characters per line". I do not intend to adhere to this rule(my terminals are usually bigger than 80 chars per line), but wouldn't it be a not bad direction to use 80 characters for all commands? Thoughts? -- Regards, -- Atsushi Torikoshi NTT DATA Group Corporation --=_f8c1c73852b5022f7fcf225c5123a8e3 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=v1-0001-Added-a-test-for-checking-the-length-of-help-outp.patch Content-Disposition: attachment; filename=v1-0001-Added-a-test-for-checking-the-length-of-help-outp.patch; size=923 RnJvbSAzZGJmZGI3OTY4MGEwYzFiNjhkNGY3NDJhZTQwODgxMGExZWU5OTlkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBdHN1c2hpI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