generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c1f9063
feat(shell): Parameterize binary names in shell integration scripts
kkashilk b40f486
feat(shell): Parameterize binary names in inline shell completion
kkashilk 2e752c3
refactor(shell): Use CLI_BINARY_NAME_UNDERSCORE for function names
kkashilk b2ce95b
remove build-dependency to fix test failures
kkashilk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| const CODEX_FOLDER: &str = "src/shell/inline_shell_completion"; | ||
|
|
||
| // Binary name constants for parameterization | ||
| const CLI_BINARY_NAME: &str = "q"; | ||
|
|
||
| // The order here is very specific, do no edit without understanding the implications | ||
| const CODEX_FILES: &[&str] = &[ | ||
| "guard_start.zsh", | ||
|
|
@@ -31,5 +34,12 @@ fn main() { | |
| println!("cargo:rerun-if-changed={}", path.display()); | ||
| inline_shell_completion.push_str(&std::fs::read_to_string(path).unwrap()); | ||
| } | ||
|
|
||
| // Substitute placeholders with actual binary names | ||
| let cli_binary_name_upper = CLI_BINARY_NAME.to_uppercase(); | ||
|
||
| inline_shell_completion = inline_shell_completion | ||
| .replace("{{CLI_BINARY_NAME}}", CLI_BINARY_NAME) | ||
| .replace("{{CLI_BINARY_NAME_UPPER}}", &cli_binary_name_upper); | ||
|
|
||
| std::fs::write(out_dir.join("inline_shell_completion.zsh"), inline_shell_completion).unwrap(); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
crates/fig_integrations/src/shell/inline_shell_completion/guard_start.zsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| if command -v _zsh_autosuggest_accept >/dev/null 2>&1; then | ||
| export Q_USING_ZSH_AUTOSUGGESTIONS=1 | ||
| export {{CLI_BINARY_NAME_UPPER}}_USING_ZSH_AUTOSUGGESTIONS=1 | ||
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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