Skip to content

Adjust boolean switch aliases to follow logical defaults#28

Merged
t-kalinowski merged 13 commits into
mainfrom
adjust-boolean-alias-defaults
Jun 10, 2026
Merged

Adjust boolean switch aliases to follow logical defaults#28
t-kalinowski merged 13 commits into
mainfrom
adjust-boolean-alias-defaults

Conversation

@t-kalinowski

@t-kalinowski t-kalinowski commented Jun 6, 2026

Copy link
Copy Markdown
Member

Summary

This makes boolean switch help default-driven without making parsing brittle. Help now shows the most useful spelling for changing the default, while the parser accepts common explicit boolean forms users are likely to try.

User-facing changes

  • FALSE, TRUE, and NA logical defaults are boolean switches by default.
  • Help shows --foo for foo <- FALSE, --no-foo for foo <- TRUE, and --foo / --no-foo for foo <- NA.
  • Switch help no longer generates default text such as [default: true], [enabled by default], or toggle hints. It shows the flag spelling plus any user-provided description.
  • Boolean switches accept bare toggles and explicit values: --foo, --no-foo, --foo=true, --foo=false, --foo true, and --foo false where the alias is enabled.
  • Bare --foo and --no-foo count as supplied values; omitted foo <- NA remains NA.
  • Help display is intentionally narrower than parser acceptance. For example, foo <- TRUE normally shows --no-foo, but --foo=false is still accepted as an explicit value for foo.
  • #| negative_alias: false only disables the generated --no-* spelling. It does not disable --foo or explicit value forms such as --foo=false.
  • If foo <- TRUE uses #| negative_alias: false, help falls back to --foo <FOO> because there is no default-changing bare alias left.
  • #| arg_type: option remains available when a boolean input should require an explicit value; generated --no-* spellings are rejected for these explicit bool options.
  • The README links to a new boolean behavior table in docs/boolean-options.md.

Internal changes

  • Split boolean switch handling into accepts_* helpers for parser acceptance and shows_* helpers for help display.
  • Parse optional boolean values after positive switches while preserving positional arguments through pushback.
  • Reject disabled negative aliases and explicit bool-option --no-* spellings before positional fallback.
  • Keep short aliases aligned with the default-driven spelling shown in help.
  • Add regression coverage for tri-state switches, disabled negative aliases, explicit boolean values, required boolean option values, short aliases, positional fallback rejection, and switch help output.

@t-kalinowski t-kalinowski marked this pull request as ready for review June 9, 2026 16:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9398a7d5d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread R/utils.R Outdated
Comment thread R/args.R Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbc5784f54

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread R/utils.R Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16dd0bf969

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread R/args.R
@t-kalinowski t-kalinowski merged commit 077a395 into main Jun 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant