Uh oh!
There was an error while loading. Please reload this page.
Add -V/--version and name the invoked command in the usage output - #593
Conversation
Two CLI reporting fixes: - New -V/--version standalone mode: prints "jawk <version>" and the Java runtime, then exits 0. The version comes from the jar manifest's Implementation-Version (now generated via addDefaultImplementationEntries), with the Maven pom.properties resource as fallback and "unknown" when running from a plain class directory. Fixes#590. - usage() now names the command Jawk was invoked as: the launchers written by the one-command installers export their invocation name through the new JAWK_PROGRAM_NAME environment variable, and the CLI falls back to the "java -jar <jar>" form when the variable is not set, which stays correct for direct jar invocations. Fixes#591. The installer smoke tests assert both behaviors through the installed launchers, probing with --version first so they keep passing against releases that predate the feature. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bertysentry
commented
Aug 19, 2026
@codex please review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:123100a514
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| AwkTestSupport.TestResult result = AwkTestSupport | ||
| .cliTest("CLI --version prints the Jawk and Java versions") |
There was a problem hiding this comment.
Test non-script reporting modes without AwkTestSupport
These new --version tests—and the new help-output tests below—do not run an AWK script, but route through AwkTestSupport.cliTest. The repository explicitly limits that helper to executing AWK scripts and requires ordinary Java behavior to be exercised directly with plain JUnit assertions; instantiate Cli with captured streams and call parse/run directly instead.
AGENTS.md reference: AGENTS.md:L23-L29
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 152cae1: the -h/--version reporting-mode tests now drive Cli directly with captured streams and plain JUnit assertions (including the pre-existing -o help test, for consistency). The ARGV pass-through test keeps AwkTestSupport since it runs a script.
| ## Execution Notes | ||
| - `--dump-syntax`, `--dump-intermediate`, `-K`, `-h`, `-?`, and `--list-ext` do not execute the script, and ignore `--persist` and `JAWK_PERSISTENT_MEMORY`. `--profile` does execute it, and keeps the normal AWK output on stdout. | ||
| - `--dump-syntax`, `--dump-intermediate`, `-K`, `-h`, `-?`, `-V`, `--version`, and `--list-ext` do not execute the script, and ignore `--persist` and `JAWK_PERSISTENT_MEMORY`. `--profile` does execute it, and keeps the normal AWK output on stdout. |
There was a problem hiding this comment.
Distinguish rejected --persist from ignored persistence
For jawk --persist state --version (in either order), parsing rejects the arguments because --version must be used alone, so the command-line --persist option is not ignored as this sentence claims. Only an ambient JAWK_PERSISTENT_MEMORY value is silently irrelevant to a standalone version run; document that distinction so the new CLI behavior is described consistently with line 77 and the implementation.
AGENTS.md reference: AGENTS.md:L35-L39
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 152cae1: the sentence now separates the modes that ignore --persist (--dump-syntax, --dump-intermediate, -K) from the standalone modes that reject it as an extra argument, with only an ambient JAWK_PERSISTENT_MEMORY being ignored by all of them.
| # command in its help instead of "java -jar ...". Releases up to | ||
| # 7.1.00 predate --version and JAWK_PROGRAM_NAME, so probe with | ||
| # --version first and only assert on releases that support it. | ||
| if out="$("${HOME}/.local/bin/jawk" --version 2>/dev/null)"; then |
There was a problem hiding this comment.
Stop treating every version failure as a legacy release
In the POSIX installer smoke job here, and equivalently in the Windows shim job, every nonzero --version result takes the legacy-release skip path. Once a release supports this option, a regression that makes --version fail will therefore still leave both smoke jobs green instead of enforcing the feature they were added to test; use the probed release version or another explicit capability boundary to skip only known legacy releases and fail for supported ones.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 152cae1: both jobs now skip only releases <= 7.1.00 (POSIX compares the probed release version with sort -V; Windows reads the installed jar's pom.properties like the pinned-version check) and otherwise require --version to succeed, so a regression fails the job.
- Non-script reporting-mode tests (-h, --version) no longer go through AwkTestSupport, which is reserved for tests that run AWK scripts: they drive Cli directly with captured streams and plain JUnit assertions. - cli-reference.md now distinguishes the modes that ignore --persist (--dump-syntax, --dump-intermediate, -K) from the standalone modes that reject it as an extra argument. - The installer smoke tests skip the version/help assertions only for releases up to 7.1.00 (the last without --version), instead of treating any --version failure as a legacy release, so a regression in a later release fails the jobs. The Windows job reads the installed version from the jar's pom.properties, like the POSIX pinned-version check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bertysentry
commented
Aug 19, 2026
@codex please review again |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:152cae1b64
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # 7.1.00 predate --version and JAWK_PROGRAM_NAME: skip only those, | ||
| # so a --version regression in a later release fails this job. | ||
| latest="${{ steps.release.outputs.version }}" | ||
| if [ "$(printf '%s\n' 7.1.00 "${latest}" | sort -V | tail -n 1)" = "7.1.00" ]; then |
There was a problem hiding this comment.
Enforce checks for the first supporting release
Checked both new installer smoke-test sections: this cutoff skips v7.1.00, but pom.xml:6 identifies the current development line as 7.1.00-SNAPSHOT, so v7.1.00 is expected to be the first release containing --version and JAWK_PROGRAM_NAME. As a result, regressions in that first supported release take the legacy skip path here and in the Windows [version]...-le check instead of failing the jobs. Fresh evidence beyond the prior thread is the repository's current development version; use the last genuinely legacy release as the cutoff.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: the cutoff is now 7.0.01, the last release that actually predates the feature (7.1.00-SNAPSHOT is the current development line, so 7.1.00 will be the first supporting release).
The development line is 7.1.00-SNAPSHOT, so 7.1.00 will be the first release that ships --version and JAWK_PROGRAM_NAME; the last genuinely legacy release is 7.0.01. With the previous cutoff a regression in the first supporting release would have taken the skip path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bertysentry
commented
Aug 19, 2026
@codex please review again |
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#590, fixes#591.
-V/--version(#590)A new standalone mode, recognized like
-honly by itself and before the program text:Implementation-Version, whichmaven-jar-pluginnow generates viaaddDefaultImplementationEntries(theManifestResourceTransformercarries it into the standalone jar). The Mavenpom.propertiesresource is the fallback, and a plain class directory (IDE runs, unit tests) reportsunknown. No build timestamp is involved, so the build stays reproducible.-hand--list-ext; after the program text it still flows to the script throughARGV, as gawk requires (covered by a test).usage(), in the "Help and errors" group and the non-executing modes list ofcli-reference.md, and inbehavior-changes.md.Usage names the invoked command (#591)
usage()now prefers the newJAWK_PROGRAM_NAMEenvironment variable over its own jar file name, so the installed launcher's help matches what the user typed:${0##*/}in the POSIX launcher,%~n0in thejawk.cmdshim), on the-jarand the-cp(JAWK_CLASSPATH) invocations alike.java -jar jawk-x.y.z-standalone.jar -hkeeps printing thejava -jar ...form, which is correct for that invocation; a blank or unset variable falls back to it too.Smoke tests
The installer workflow now asserts, on both the POSIX launcher and the Windows shim, that
--versionreportsjawk <version>and that-hnamesjawkand never mentionsjava -jar. The steps probe with--versionfirst, so they keep passing while the latest release predates the feature.Verified end-to-end locally on both launchers (installer run into a scratch prefix, freshly built jar swapped in):
--version,-h, plain one-liners, and theJAWK_CLASSPATHcode path.🤖 Generated with Claude Code