Skip to main content

Module strict

Module strict 

Source
Expand description

Strict moreutils-compat mode entry point.

Mirrors the rusty-sponge strict.rs pattern: bypasses clap entirely (clap can’t produce byte-equal moreutils errors), runs a hand-rolled argv scan, emits moreutils-style stderr per FR-018.

§STF-003 option A

For any unknown flag, we emit ONLY the first unknown-flag error and exit non-zero. moreutils’ Perl Getopt::Long iterates per-character; we accept that as documented divergence (Strict-mode “moreutils-style” rather than “moreutils-byte-equal” — see FR-018 note).

§Recognized inputs (Strict mode)

inputbehavior
--suffix=<ext>set tempfile suffix
--end of options; rest are editor extras
--strict / --no-strictconsumed by mode resolution upstream; ignored
--help / --versionrejected per FR-013 via first-error formatter
--editor / --editor=*rejected per FR-013 via first-error formatter
completionsrejected per FR-013 via first-error formatter
other -x / --foofirst-error formatter (STF-003 option A)

Enums§

UnknownFlag
The first unknown flag encountered by the Strict-mode parser.

Functions§

format_editor_died
Moreutils-style “editor died” formatter per FR-018. Output matches the Perl die template <argv joined> exited nonzero, aborting.
format_unknown_flag
First-error-only formatter for unknown short flags per FR-018.
pre_scan_strict_flag
Pre-clap scan for --strict / --no-strict flags. Returns the resolved strict_flag value for crate::mode::resolve (last occurrence wins).
run
Strict-mode entry point. Bypasses clap entirely.