Skip to content

topmark.cli.option_groups

topmark / cli / option_groups

Command applicability groups for CLI options.

This module is a narrow metadata layer for command-applicability test coverage. It groups already-declared option spellings by the path-oriented commands that may accept them. Click remains the authoritative parser: commands that do not declare these options reject them as parser-level unknown options.

CHECK_ONLY_OPTION_REASON module-attribute

CHECK_ONLY_OPTION_REASON = (
    "Use this only with `topmark check`."
)

Reason shown when a check-only option is used with another command.

CHECK_OR_STRIP_ONLY_OPTION_REASON module-attribute

CHECK_OR_STRIP_ONLY_OPTION_REASON = (
    "Use this only with `topmark check` or `topmark strip`."
)

Reason shown when a check-or-strip-only option is used with another command.

CHECK_ONLY_GENERATED_HEADER_OPTIONS module-attribute

CHECK_ONLY_GENERATED_HEADER_OPTIONS = (
    POLICY_HEADER_MUTATION_MODE,
    POLICY_ALLOW_HEADER_IN_EMPTY_FILES,
    POLICY_NO_ALLOW_HEADER_IN_EMPTY_FILES,
    POLICY_EMPTY_INSERT_MODE,
    POLICY_RENDER_EMPTY_HEADER_WHEN_NO_FIELDS,
    POLICY_NO_RENDER_EMPTY_HEADER_WHEN_NO_FIELDS,
    POLICY_ALLOW_REFLOW,
    POLICY_NO_ALLOW_REFLOW,
    HEADER_FIELDS,
    FIELD_VALUES,
    ALIGN_FIELDS,
    NO_ALIGN_FIELDS,
    RELATIVE_TO,
)

Header generation/update controls accepted only by topmark check.

These options configure generated header content or update policy. They are not meaningful for topmark strip, which removes headers, or topmark probe, which only reports file resolution and type support.

CHECK_OR_STRIP_ONLY_PIPELINE_OPTIONS module-attribute

CHECK_OR_STRIP_ONLY_PIPELINE_OPTIONS = (
    APPLY_CHANGES,
    WRITE_MODE,
    RENDER_DIFF,
    RESULTS_SUMMARY_MODE,
    REPORT,
)

Pipeline mutation/reporting controls accepted by check and strip.

These options either control writes, patch/diff previews, or report scope. They are intentionally rejected by topmark probe, which remains read-only and focused on discovery diagnostics.

PROBE_FORBIDDEN_OPTIONS module-attribute

PROBE_FORBIDDEN_OPTIONS = {
    None: fromkeys(
        CHECK_OR_STRIP_ONLY_PIPELINE_OPTIONS,
        CHECK_OR_STRIP_ONLY_OPTION_REASON,
    ),
    None: fromkeys(
        CHECK_ONLY_GENERATED_HEADER_OPTIONS,
        CHECK_ONLY_OPTION_REASON,
    ),
}

Options that topmark probe must not declare.

The values document the historical command-applicability rationale and keep test parameterization close to production option metadata.

STRIP_FORBIDDEN_OPTIONS module-attribute

STRIP_FORBIDDEN_OPTIONS = fromkeys(
    CHECK_ONLY_GENERATED_HEADER_OPTIONS,
    CHECK_ONLY_OPTION_REASON,
)

Options that topmark strip must not declare.

The values document the historical command-applicability rationale and keep test parameterization close to production option metadata.