Skip to content
Snippets Groups Projects

Resolve "Add zsh, fish, and bash shell completion helper function generation as well as the related command"

2 files
+ 9
5
Compare changes
  • Side-by-side
  • Inline

Files

@@ -60,9 +60,11 @@ source ${filename}
const spinner: ora.Ora = ora(`Modifying ${path} ...`).start();
if (existsSync(path)) {
const data = readFileSync(path)
let updated = false;
if (!data.includes('autoload -U +X compinit && compinit')) {
try {
appendFileSync(path, 'autoload -U +X compinit && compinit')
updated = true
} catch {
spinner.fail(`Error appending in ${this.zprofile}`);
}
@@ -70,6 +72,7 @@ source ${filename}
if (!data.includes('autoload -U +X bashcompinit && bashcompinit')) {
try {
appendFileSync(path, 'autoload -U +X bashcompinit && bashcompinit')
updated = true
} catch {
spinner.fail(`Error appending in ${this.zprofile}`);
}
@@ -77,11 +80,16 @@ source ${filename}
if (!data.includes(`source ${bash_path}`)) {
try {
appendFileSync(path, `source ${bash_path}`)
updated = true
} catch {
spinner.fail(`Error appending in ${this.zprofile}`);
}
}
spinner.succeed(`Zsh profile updated.`);
if (updated) {
spinner.succeed(`Zsh profile updated.`);
} else {
spinner.succeed(`Zsh profile already up to date.`);
}
} else {
try {
writeFileSync(path, this.load_bash_completion);
Loading