Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
# argparse

## CI is pinned

Every input to CI is pinned in the source (bats-lang/repository-prototype#269),
so a commit that passes keeps passing:

* `bats.lock` is committed: CI never runs `bats lock` for the package, so
`bats check` and `bats build` fetch exactly the locked versions, and fail
when the lock is missing or does not match `bats.toml`. A library's lock
pins only its own CI and tests; its dependents still resolve their own.
* The compiler is the commit in `.github/bats-version`, read by every
workflow that builds bats (and by the publish workflow).
* The package repository is fetched at the commit in
`.github/repository-version`, so what the test packages under `tests/`
lock (`bats lock --dev`) is pinned too.
* `publish.yml` and `relock-pins.yml` in bats-lang/repository-prototype are
called by commit, never `@main`.

Pins move only through a reviewed pull request that runs the same CI. The
daily `relock.yml` (the shared `relock-pins.yml`) relocks against the
newest, moves the compiler and repository pins, pushes `relock/<date>`,
opens a pull request listing the old and new versions and dispatches
`check.yml` on it, so a breaking publish shows as a red relock pull
request and main stays green. GITHUB_TOKEN cannot change workflow files,
so without a `RELOCK_TOKEN` secret that pull request lists a workflow pin
that would move instead of moving it: move it in a pull request of its
own. A pull request that needs newer packages runs `bats lock
--repository <dir>` and commits `bats.lock` (and
`.github/repository-version`) with the change.
CI: see bats-lang/repository-prototype's CLAUDE.md, "A library's check.yml is a caller of package-check.yml" and "CI Pattern: every input is pinned".
26 changes: 0 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,6 @@

Command-line argument parser for the [Bats](https://github.com/bats-lang) programming language.

## Features

- Flag arguments (`--verbose`, `-v`)
- String options (`--name value`)
- Positional arguments
- Help text generation
- Parses from raw `/proc/self/cmdline`-style null-separated buffers

## Usage

```bats
#use argparse as AP

val p = $AP.parser_new(name_bv, name_len, desc_bv, desc_len)
val @(p, h_verbose) = $AP.add_flag(p, name_bv, name_len, $R.some(118) (* -v *), help_bv, help_len)
val @(p, h_file) = $AP.add_string(p, name_bv, name_len, $R.none(), help_bv, help_len, false)
val @(p, h_jobs) = $AP.add_int(p, name_bv, name_len, $R.none(), help_bv, help_len, 1, $AP.IntBetween(1, 8))
val result = $AP.parse(p, cmdline_bv, cmdline_max, argc)
```

A short name is `$R.some(c)` or `$R.none()`; an int's range is `AnyInt()` or
`IntBetween(low, high)`; the subcommand chosen (`get_subcmd`) is an option.
A failure is a `parse_error`: `err_unknown_long` (with the closest option,
if any), `err_unknown_short`, `err_range`, `err_not_int`, `err_exclusive`,
`err_choice` or `err_too_long`.

## API

See [docs/lib.md](docs/lib.md) for the full API reference.
Expand Down
Loading