From c83e72a637fb1a95ba9d23bb4f9f4f4a16afcc03 Mon Sep 17 00:00:00 2001 From: benhancock Date: Thu, 5 Dec 2024 13:42:34 -0500 Subject: [PATCH] fix: add completion support for ntl aliasin zsh Co-authored-by: Dylan Spyer --- src/commands/completion/completion.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/commands/completion/completion.ts b/src/commands/completion/completion.ts index 9c69fcb32c8..7a74a64b359 100644 --- a/src/commands/completion/completion.ts +++ b/src/commands/completion/completion.ts @@ -34,6 +34,21 @@ export const completionGenerate = async (options: OptionValues, command: BaseCom name: parent.name(), completer, }) + + const completionScriptPath = join(homedir(), `.config/tabtab/${parent.name()}.zsh`) + + if (fs.existsSync(completionScriptPath)) { + let completionScript = fs.readFileSync(completionScriptPath, 'utf8') + + completionScript = completionScript.replace( + /compdef _netlify_completion netlify/, + 'compdef _netlify_completion netlify ntl', + ) + + fs.writeFileSync(completionScriptPath, completionScript, 'utf8') + log(`Added alias 'ntl' to completion script.`) + } + const zshConfigFilepath = join(process.env.HOME || homedir(), '.zshrc') if (