docs.rs failed to build libargs-rs-1.0.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
libargs
Unix/GNU-style argument parsing library written in C, with native bindings for Rust and Python.
Supports every convention from POSIX and GNU:
| Syntax | Meaning |
|---|---|
-v |
short boolean flag |
-xvz |
combined short flags |
-fFILE |
short option, value attached |
-f FILE |
short option, value separated |
--verbose |
long boolean flag |
--file=FILE |
long option, = separator |
--file FILE |
long option, space separator |
--no-FLAG |
long boolean negation |
-- |
end of options — everything after is positional |
- |
stdin placeholder — treated as positional |
POSIXLY_CORRECT env |
stop at first non-option argument |
Build everything
Requirements:
| Tool | Min version | Alpine | Ubuntu/Debian |
|---|---|---|---|
| GCC | 11+ | apk add gcc musl-dev make |
apt install build-essential |
| Rust/Cargo | 1.65+ | apk add cargo |
apt install cargo |
| Python | 3.8+ | apk add python3-dev py3-pip |
apt install python3-dev |
C library
int
Link:
# static
# shared
API summary:
void ;
args_err_t ;
args_opt_t *;
args_opt_t *;
void ;
void ;
void ;
Rust
Add to Cargo.toml:
[]
= "1.0"
use ;
ParseResult API:
r.flag .string .int .float .count // how many times seen
r.values // all occurrences (repeated opts)
r.positionals
r.dashdash_seen
Python
=
=
ParseResult API:
# bool
# str | None
# int | None
# float | None
# int — how many times seen
# list[str] — all occurrences
# list[str]
# bool
Test results
C 67/67 tests passed (musl + glibc, ASAN where available)
Rust 22/22 tests passed + 1 doc-test
Python 35/35 tests passed (isolated venv)
Build script reference
License
MIT — see LICENSE.