Skip to content

Add extension placeholder#2012

Open
puneetdixit200 wants to merge 1 commit into
sharkdp:masterfrom
puneetdixit200:fix/1818-extension-placeholder
Open

Add extension placeholder#2012
puneetdixit200 wants to merge 1 commit into
sharkdp:masterfrom
puneetdixit200:fix/1818-extension-placeholder

Conversation

@puneetdixit200
Copy link
Copy Markdown

Summary:

  • add a {.ext} formatter token that expands to the current path's file extension
  • wire it through --format, --exec, and --exec-batch placeholder parsing
  • add unit and integration coverage, CLI help text, and a changelog entry

I used a single {.ext} placeholder because Rust's Path::extension() is based on the final path component, so {.ext} and {/.ext} would return the same value.

AI assistance: an AI coding assistant helped draft the patch and tests. I reviewed the change and ran the verification below.

Refs #1818

Tests:

  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo test fmt::fmt_tests::extension_placeholder -- --nocapture
  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo test exec::tests::tokens_with_extension -- --nocapture
  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo test fmt::input::path_tests::extension_simple -- --nocapture
  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo test --test tests format -- --nocapture
  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo test --test tests test_exec -- --nocapture
  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo fmt -- --check
  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo test
  • CARGO_HOME=/tmp/fd-1818-cargo-home CARGO_TARGET_DIR=/tmp/fd-1818-target cargo clippy --all-targets -- -D warnings
  • git diff --check

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