Skip to content

fix(commands): replace numbered placeholders in descending order#318

Open
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:fix-command-placeholder-two-digit-order
Open

fix(commands): replace numbered placeholders in descending order#318
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:fix-command-placeholder-two-digit-order

Conversation

@OnlyYu1996
Copy link
Copy Markdown

Fixes PlatformNetwork/bounty-challenge#53172.

substitute_placeholders() now replaces numbered placeholders in descending order. That prevents $1 from rewriting the prefix of $10, $11, etc. before those larger placeholders are handled.

The existing "highest numbered placeholder captures the remaining arguments" behavior is preserved; regression coverage includes both direct $10 substitution and $10 as the rest-capturing placeholder.

Validation:

  • cargo +1.90.0 fmt --package cortex-commands --check
  • cargo +1.90.0 test -p cortex-commands test_substitute_two_digit_placeholder -- --nocapture
  • cargo +1.90.0 test -p cortex-commands
  • git diff --check

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant