Skip to content
Snippets Groups Projects

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

1 unresolved thread
1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
@@ -13,10 +13,10 @@ class CompletionZshCommand extends CommanderCommand {
@@ -13,10 +13,10 @@ class CompletionZshCommand extends CommanderCommand {
private zprofile: string = path.join(homedir(), '.zprofile');
private zprofile: string = path.join(homedir(), '.zprofile');
private bash_completion = path.join(homedir(), '.bash_completion');
private bash_completion = path.join(homedir(), '.bash_completion');
private load_bash_completion = `
private load_bash_completion = `
# Added by DojoCLI
autoload -U +X compinit && compinit
autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
autoload -U +X bashcompinit && bashcompinit
source ${this.bash_completion}
source ${ this.bash_completion }
`;
`;
@@ -64,7 +64,7 @@ source ${ filename }
@@ -64,7 +64,7 @@ source ${ filename }
let updated = false;
let updated = false;
if ( !data.includes('autoload -U +X compinit && compinit') ) {
if ( !data.includes('autoload -U +X compinit && compinit') ) {
try {
try {
fs.appendFileSync(path, 'autoload -U +X compinit && compinit');
fs.appendFileSync(path, '\nautoload -U +X compinit && compinit');
updated = true;
updated = true;
} catch {
} catch {
spinner.fail(`Error appending in ${ this.zprofile }`);
spinner.fail(`Error appending in ${ this.zprofile }`);
@@ -72,7 +72,7 @@ source ${ filename }
@@ -72,7 +72,7 @@ source ${ filename }
}
}
if ( !data.includes('autoload -U +X bashcompinit && bashcompinit') ) {
if ( !data.includes('autoload -U +X bashcompinit && bashcompinit') ) {
try {
try {
fs.appendFileSync(path, 'autoload -U +X bashcompinit && bashcompinit');
fs.appendFileSync(path, '\nautoload -U +X bashcompinit && bashcompinit');
updated = true;
updated = true;
} catch {
} catch {
spinner.fail(`Error appending in ${ this.zprofile }`);
spinner.fail(`Error appending in ${ this.zprofile }`);
@@ -80,7 +80,7 @@ source ${ filename }
@@ -80,7 +80,7 @@ source ${ filename }
}
}
if ( !data.includes(`source ${ bash_path }`) ) {
if ( !data.includes(`source ${ bash_path }`) ) {
try {
try {
fs.appendFileSync(path, `source ${ bash_path }`);
fs.appendFileSync(path, `\nsource ${ bash_path }`);
updated = true;
updated = true;
} catch {
} catch {
spinner.fail(`Error appending in ${ this.zprofile }`);
spinner.fail(`Error appending in ${ this.zprofile }`);
Loading