Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR update documents for release and fix several issues.
The main reason to upgrade is an FFI signature clash in _read_password_asterisk(). Our read(2) binding passed its buffer as Int(ptr), declaring read as (Int, Int, Int) -> Int while the standard library declares the same symbol with a pointer. Any module linking both failed to lower to LLVM IR, so this could break the build of a project that merely depends on ArgMojo. The buffer is passed as a real pointer now.
Twelve parser bugs are fixed. Several of them share one root cause: has() is true for an argument that only carries a .default(), and four group constraints plus implies() were using it to mean "the user typed this". They ask the new was_provided() now. The rest are independent: defaults were all written to the string store, so a .flag().default()
was invisible to get_flag(); an argument with both .prompt() and .default() was never prompted; an option could swallow the next option as its value; a required positional could be satisfied by a later positional's default; persistent-argument conflicts were caught in only one registration order; non-ASCII passwords came back corrupted; and
--=helloset the first positional instead of being rejected. Bad defaults are now caught at registration rather than reaching the user.New API: was_provided() and get_float() on ParseResult, working Float64 options and positionals, Int() unwrapping for Count, and a consistent parameter set across the four declarative wrappers, so a positional no longer has to drop to the builder API for prompt, password, hidden, deprecated or ranges.
Compiling a program that uses ArgMojo is about 20% faster. Most of it is examples/build.sh linking the prebuilt package instead of recompiling the sources into all eight binaries; the rest is argument lookup returning an index instead of deep-copying the Argument on every option token, String(...) in place of long + chains, and byte comparisons in _looks_like_number() and _levenshtein(). Help text, completion scripts and error messages are byte-for-byte identical before and after.
CI also runs tests/test_dispatch.mojo now. It was in the local test task but in none of the workflow jobs, so the auto-dispatch tests added in v0.6.0 had never run on a pull request.
733 tests across 13 modules pass, along with the negative schema checks and all eight examples.