Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make --character-set an alias for --charset at the CLI#1590

Merged
rolandwalker merged 1 commit intomainfrom
RW/accept-character-set-cli-argument
Feb 20, 2026
Merged

Make --character-set an alias for --charset at the CLI#1590
rolandwalker merged 1 commit intomainfrom
RW/accept-character-set-cli-argument

Conversation

@rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Feb 20, 2026

Description

Make --character-set an alias for --charset at the CLI, for alignment with the spelling of the equivalent option in ~/.myclirc.

Internally, refactor to use character_set instead of charset wherever possible. The form charset is limited to the invocation of pymysql's connect().

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Feb 20, 2026
@github-actions
Copy link

Findings

  • Missing test: No CLI test covers --character-set parsing. Add a small CLI invocation test to ensure --character-set maps to the same runtime charset behavior as --charset (e.g., in test/ for CLI option parsing). This prevents regressions if click options are refactored. mycli/main.py:1713

Notes

  • No correctness or security issues spotted in this change.

@rolandwalker rolandwalker requested review from amjith and scottnemes and removed request for amjith and scottnemes February 20, 2026 12:32
Copy link
Contributor

@scottnemes scottnemes left a comment

Choose a reason for hiding this comment

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

Did you want to add in deprecation for --charset or just accept both indefinitely? Good to go either way, verified the alias works.

@rolandwalker rolandwalker force-pushed the RW/accept-character-set-cli-argument branch 2 times, most recently from 6ebee83 to af90ad9 Compare February 20, 2026 20:19
@rolandwalker
Copy link
Contributor Author

@scottnemes I'm fine with accepting both indefinitely. We have enough pending deprecations!

But, I pushed an amended version of the PR and am re-requesting review. It is functionally identical, but it goes farther and changes all the internal uses of charset to character_set. Sort of making --character-set the default, and --charset the alias.

@rolandwalker rolandwalker added codex request Codex review for an updated PR labels Feb 20, 2026
@github-actions
Copy link

Review Summary

No correctness or security issues found in the diff. One test gap to cover the new alias behavior.

Findings (ordered by severity)

  1. Missing tests for the new CLI alias.
    mycli/main.py:1715
    You added --character-set as an alias for --charset, but there’s no test ensuring both flags are accepted and mapped to the same character_set value. Add a CLI test that invokes both --charset and --character-set and asserts the resulting character_set value reaches MyCli.connect or SQLExecute.

Notes

  • I did not run tests.

@github-actions
Copy link

No correctness, security, or regression issues found in the code changes.

Missing tests

  1. Add a CLI parsing test to assert both --charset and --character-set set the same value and still flow into character_set for the connection path (e.g., in test/test_main.py). This would cover the new alias and prevent accidental regressions.

Optional (docs)

  1. mycli/TIPS still mentions only --charset; consider updating it to mention the new alias for consistency.

at the CLI, for alignment with the spelling of the equivalent option in
~/.myclirc.

Internally, refactor to use "character_set" instead of "charset"
wherever possible.  The form "charset" is limited to the invocation of
pymysql's connect().
@rolandwalker rolandwalker force-pushed the RW/accept-character-set-cli-argument branch from af90ad9 to defc199 Compare February 20, 2026 20:26
Copy link
Contributor

@scottnemes scottnemes left a comment

Choose a reason for hiding this comment

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

Verified the option file and CLI values work as expected

@rolandwalker rolandwalker merged commit ed86161 into main Feb 20, 2026
13 of 14 checks passed
@rolandwalker rolandwalker deleted the RW/accept-character-set-cli-argument branch February 20, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex request Codex review for an updated PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants