Skip to content

Conversation

@kkashilk
Copy link
Contributor

Issue #, if available:

Description of changes:

  • Add {{CLI_BINARY_NAME}} and {{PTY_BINARY_NAME}} placeholders to all shell scripts
  • Update pre.sh, pre.fish, pre.nu to use placeholders
  • Update post.bash, post.fish, post.zsh, post.nu to use placeholders
  • Modify get_fig_integration_source() to return String and perform substitution
  • Replace hardcoded 'q' and 'qterm' with constants from fig_util::consts
  • Remove unnecessary .into() call in init.rs

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Add {{CLI_BINARY_NAME}} and {{PTY_BINARY_NAME}} placeholders to all shell scripts
- Update pre.sh, pre.fish, pre.nu to use placeholders
- Update post.bash, post.fish, post.zsh, post.nu to use placeholders
- Modify get_fig_integration_source() to return String and perform substitution
- Replace hardcoded 'q' and 'qterm' with constants from fig_util::consts
- Remove unnecessary .into() call in init.rs

This enables easy rebranding by changing constants in one place.
@kkashilk kkashilk requested a review from a team as a code owner October 29, 2025 21:36
- Add {{CLI_BINARY_NAME}} and {{CLI_BINARY_NAME_UPPER}} placeholders to all inline shell completion .zsh files
- Update build.rs to perform runtime substitution of placeholders
- Replace all _q_ function prefixes with _{{CLI_BINARY_NAME}}_
- Replace all _Q_ and Q_ variable prefixes with _{{CLI_BINARY_NAME_UPPER}}_ and {{CLI_BINARY_NAME_UPPER}}_
- Replace hardcoded 'q' binary commands with {{CLI_BINARY_NAME}}
- Add CLI_BINARY_NAME constant at top of build.rs

This enables changing binary names by updating constants in one place.
const CODEX_FOLDER: &str = "src/shell/inline_shell_completion";

// Binary name constants for parameterization
const CLI_BINARY_NAME: &str = "q";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can fig_util be a build dependency, so we don't have to duplicate it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

}

// Substitute placeholders with actual binary names
let cli_binary_name_upper = CLI_BINARY_NAME.to_uppercase();
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the binary name has a - in it? Should we also replace - with _?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

- Add fig_util as build-dependency to access CLI_BINARY_NAME constant
- Introduce CLI_BINARY_NAME_UNDERSCORE placeholder for function names (handles hyphens)
- Replace _{{CLI_BINARY_NAME}}_ with _{{CLI_BINARY_NAME_UNDERSCORE}}_ in all function names
- Keep {{CLI_BINARY_NAME}} for actual binary command usage
- Update build.rs to convert hyphens to underscores for function names
- Update test to use underscore version for function name checks
@kkashilk kkashilk force-pushed the parameterize-remaining branch from 2df7690 to 2e752c3 Compare October 29, 2025 23:33
@kkashilk kkashilk merged commit 3cf116d into main Oct 30, 2025
23 of 27 checks passed
@kkashilk kkashilk deleted the parameterize-remaining branch October 30, 2025 16:57
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.

3 participants