Skip to content

Commit

Permalink
fix: add completion support for ntl aliasin zsh
Browse files Browse the repository at this point in the history
Co-authored-by: Dylan Spyer <[email protected]>
  • Loading branch information
benhancock and dylanspyer committed Dec 5, 2024
1 parent 6d9315b commit c83e72a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/commands/completion/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit c83e72a

Please sign in to comment.