-
Notifications
You must be signed in to change notification settings - Fork 40
feat(shell): Parameterize binary names in shell integration scripts #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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.
- 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"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
crates/fig_integrations/build.rs
Outdated
| } | ||
|
|
||
| // Substitute placeholders with actual binary names | ||
| let cli_binary_name_upper = CLI_BINARY_NAME.to_uppercase(); |
There was a problem hiding this comment.
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 _?
There was a problem hiding this comment.
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
2df7690 to
2e752c3
Compare
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.