Skip to content

Commit

Permalink
feat: use ansis instead of chalk
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed May 28, 2024
1 parent b14f4a9 commit 22d3226
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/oclif/plugin-autocomplete/issues",
"dependencies": {
"@oclif/core": "^4.0.0-beta.13",
"chalk": "^5.3.0",
"ansis": "^3.2.0",
"debug": "^4.3.4",
"ejs": "^3.1.10"
},
Expand Down
38 changes: 19 additions & 19 deletions src/commands/autocomplete/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Args, Flags, ux} from '@oclif/core'
import chalk from 'chalk'
import {bold, cyan} from 'ansis'
import {EOL} from 'node:os'

import {AutocompleteBase} from '../../base.js'
Expand Down Expand Up @@ -38,7 +38,7 @@ export default class Index extends AutocompleteBase {
)
}

ux.action.start(`${chalk.bold('Building the autocomplete cache')}`)
ux.action.start(`${bold('Building the autocomplete cache')}`)
await Create.run([], this.config)
ux.action.stop()

Expand All @@ -62,22 +62,22 @@ Setup Instructions for ${this.config.bin.toUpperCase()} CLI Autocomplete ---
instructions += `
1) Run this command in your terminal window:
${chalk.cyan(`printf "eval $(${scriptCommand})" >> ~/.bashrc; source ~/.bashrc`)}
${cyan(`printf "eval $(${scriptCommand})" >> ~/.bashrc; source ~/.bashrc`)}
The previous command adds the ${chalk.cyan(setupEnvVar)} environment variable to your Bash config file and then sources the file.
The previous command adds the ${cyan(setupEnvVar)} environment variable to your Bash config file and then sources the file.
${chalk.bold('NOTE')}: If you’ve configured your terminal to start as a login shell, you may need to modify the command so it updates either the ~/.bash_profile or ~/.profile file. For example:
${bold('NOTE')}: If you’ve configured your terminal to start as a login shell, you may need to modify the command so it updates either the ~/.bash_profile or ~/.profile file. For example:
${cyan(`printf "eval $(${scriptCommand}) >> ~/.bash_profile; source ~/.bash_profile`)}
${chalk.cyan(`printf "eval $(${scriptCommand}) >> ~/.bash_profile; source ~/.bash_profile`)}
Or:
${chalk.cyan(`printf "eval $(${scriptCommand})" >> ~/.profile; source ~/.profile`)}
${cyan(`printf "eval $(${scriptCommand})" >> ~/.profile; source ~/.profile`)}
2) Start using autocomplete:
${chalk.cyan(`${this.config.bin} ${tabStr}`)} # Command completion
${chalk.cyan(`${this.config.bin} command --${tabStr}`)} # Flag completion
${cyan(`${this.config.bin} ${tabStr}`)} # Command completion
${cyan(`${this.config.bin} command --${tabStr}`)} # Flag completion
`
break
}
Expand All @@ -86,18 +86,18 @@ Setup Instructions for ${this.config.bin.toUpperCase()} CLI Autocomplete ---
instructions += `
1) Run this command in your terminal window:
${chalk.cyan(`printf "eval $(${scriptCommand})" >> ~/.zshrc; source ~/.zshrc`)}
${cyan(`printf "eval $(${scriptCommand})" >> ~/.zshrc; source ~/.zshrc`)}
The previous command adds the ${chalk.cyan(setupEnvVar)} environment variable to your zsh config file and then sources the file.
The previous command adds the ${cyan(setupEnvVar)} environment variable to your zsh config file and then sources the file.
2) (Optional) Run this command to ensure that you have no permissions conflicts:
${chalk.cyan('compaudit -D')}
${cyan('compaudit -D')}
3) Start using autocomplete:
${chalk.cyan(`${this.config.bin} ${tabStr}`)} # Command completion
${chalk.cyan(`${this.config.bin} command --${tabStr}`)} # Flag completion
${cyan(`${this.config.bin} ${tabStr}`)} # Command completion
${cyan(`${this.config.bin} command --${tabStr}`)} # Flag completion
`
break
}
Expand All @@ -106,17 +106,17 @@ Setup Instructions for ${this.config.bin.toUpperCase()} CLI Autocomplete ---
instructions += `
1) Run these two cmdlets in your PowerShell window in the order shown:
${chalk.cyan(`New-Item -Type Directory -Path (Split-Path -Parent $PROFILE) -ErrorAction SilentlyContinue
${cyan(`New-Item -Type Directory -Path (Split-Path -Parent $PROFILE) -ErrorAction SilentlyContinue
Add-Content -Path $PROFILE -Value (Invoke-Expression -Command "${scriptCommand}"); .$PROFILE`)}
2) (Optional) If you want matching completions printed below the command line, run this cmdlet:
${chalk.cyan('Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete')}
${cyan('Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete')}
3) Start using autocomplete:
${chalk.cyan(`${this.config.bin} ${tabStr}`)} # Command completion
${chalk.cyan(`${this.config.bin} command --${tabStr}`)} # Flag completion
${cyan(`${this.config.bin} ${tabStr}`)} # Command completion
${cyan(`${this.config.bin} command --${tabStr}`)} # Flag completion
`
break
}
Expand Down

0 comments on commit 22d3226

Please sign in to comment.