Skip to content

refactor(builtins): migrate base64 from manual arg parsing to ArgParser#890

Merged
chaliy merged 2 commits intomainfrom
refactor/issue-880-argparser-base64
Mar 30, 2026
Merged

refactor(builtins): migrate base64 from manual arg parsing to ArgParser#890
chaliy merged 2 commits intomainfrom
refactor/issue-880-argparser-base64

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 27, 2026

Summary

  • Replace manual while i < ctx.args.len() index management with ArgParser API in the base64 builtin
  • Uses flag_any, flag_value, positional, and is_flag for cleaner argument handling
  • Net -2 lines, clearer intent

Test plan

  • All 6 existing base64 unit tests pass
  • cargo clippy clean
  • cargo fmt --check clean

Part of #880

@chaliy chaliy force-pushed the refactor/issue-880-argparser-base64 branch from 7f1919b to 16e1c5c Compare March 28, 2026 00:11
@chaliy chaliy requested a review from Copilot March 30, 2026 16:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the base64 builtin’s argument handling to use the shared ArgParser utility instead of manual index-based parsing, aligning with the incremental migration effort in #880.

Changes:

  • Replaced the while i < ctx.args.len() loop with an ArgParser-driven loop.
  • Implemented flag parsing via flag_any, flag_value, and is_flag, while preserving existing behaviors like silently accepting --ignore-garbage.
  • Kept support for --wrap=COLS while simplifying overall control flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Replace manual `while i < ctx.args.len()` index management with
ArgParser API in the base64 builtin. Uses flag_any, flag_value,
positional, and is_flag for cleaner argument handling.

Part of #880
@chaliy chaliy force-pushed the refactor/issue-880-argparser-base64 branch from 16e1c5c to d543275 Compare March 30, 2026 16:57
@chaliy chaliy merged commit ac7ad0d into main Mar 30, 2026
27 checks passed
@chaliy chaliy deleted the refactor/issue-880-argparser-base64 branch March 30, 2026 17:36
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.

2 participants