From 93c9bd1cafcb01b8f482ec39757ba5de53cf5b1e Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Thu, 6 Feb 2025 11:17:29 -0800 Subject: [PATCH 1/2] flux-job: don't override `-L, --color` with `-H, --human` Problem: The `-H, --human` option of `flux job eventlog` and `flux job wait-event` forces `--color=auto`, but this breaks usage like `-HL` to force color on (e.g. if passed to `less`). Do not overwrite the color option with `--human`. The default is already `auto`, so there's no need. --- src/cmd/job/eventlog.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cmd/job/eventlog.c b/src/cmd/job/eventlog.c index 8e9fa8becd86..6d4bf16f41e5 100644 --- a/src/cmd/job/eventlog.c +++ b/src/cmd/job/eventlog.c @@ -146,7 +146,6 @@ static void formatter_parse_options (optparse_t *p, if (optparse_hasopt (p, "human")) { format = "text", time_format = "human"; - when = "auto"; } if (eventlog_formatter_set_format (evf, format) < 0) From 3a175c2ac4b18aea3c6856be86b3b19ee2ef9dec Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Thu, 6 Feb 2025 11:19:40 -0800 Subject: [PATCH 2/2] testsuite: add test for `-HL` behavior in `flux-job(1)` Problem: The `flux job wait-event` and `eventlog` tests do not ensure that the options `-HL` enable human timestamps but also force color. Add this option usage to existing tests that check that color is force-enabled. --- t/t2230-job-info-lookup.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2230-job-info-lookup.t b/t/t2230-job-info-lookup.t index 34fb6b4d56ae..c7cf2b425061 100755 --- a/t/t2230-job-info-lookup.t +++ b/t/t2230-job-info-lookup.t @@ -282,7 +282,7 @@ test_expect_success 'flux job eventlog/wait-event reject invalid --color' ' test_must_fail flux job eventlog --color=foo $jobid && test_must_fail flux job wait-event --color=foo $jobid ' -for opt in "-L" "-Lalways" "--color" "--color=always"; do +for opt in "-HL" "-L" "-Lalways" "--color" "--color=always"; do test_expect_success "flux job eventlog $opt forces color on" ' name=notty${opt##--color=} && outfile=color-${name:-default}.out &&