Skip to content
Snippets Groups Projects
Commit d50b7418 authored by michael.minelli's avatar michael.minelli
Browse files

Sonar => Restore o. malaspinas comments

parent eaf6bb41
No related branches found
No related tags found
1 merge request!10Resolve "Add sonar integration"
Pipeline #29991 failed
This commit is part of merge request !10. Comments created here will be created in the context of that merge request.
Subproject commit ffc5d65f9f0f0e825688177425e526131aa84631
Subproject commit f572bf3afa0a98675247df85c599b5d1e5a62d0d
......@@ -11,7 +11,7 @@ import GlobalHelper from '../../../helpers
class CompletionBashCommand extends CommanderCommand {
protected commandName: string = 'bash';
private installPath = path.join(os.homedir(), '.bash_completion');
private readonly installPath = path.join(os.homedir(), '.bash_completion');
protected defineCommand() {
GlobalHelper.completionCommandDefinition(this.command)
......@@ -48,8 +48,8 @@ For more details: ${ TextStyle.URL('https://github.com/scop/bash-completion/blob
/* The completion command must do the following:
- if a file is provided:
- if force is not enabled:
- check if the file exists:
- if it exists, prompt the user that it will be erased
- check if the bash completion file exists:
- if it exists, prompt the user that it will be overwritten
- if ok is given write the file and prompt that a backup has been created
- else create the file containing the completion
- else
......@@ -59,6 +59,7 @@ For more details: ${ TextStyle.URL('https://github.com/scop/bash-completion/blob
- if ok is given write the file and prompt that a backup has been created
- else
- create the file containing the completion
- create a .zprofile or append the appropriate commands into the .zprofile file
*/
protected async commandAction(options: { file: string, force: boolean }): Promise<void> {
const filePath = path.resolve(options.file ?? this.installPath); // change that if file is empty
......
......@@ -11,13 +11,13 @@ import GlobalHelper from '../../../helpers
class CompletionZshCommand extends CommanderCommand {
protected commandName: string = 'zsh';
private zprofile: string = path.join(homedir(), '.zprofile');
private bash_completion = path.join(homedir(), '.bash_completion');
private load_bash_completion = `
private readonly zprofile: string = path.join(homedir(), '.zprofile');
private readonly bashCompletion = path.join(homedir(), '.bash_completion');
private readonly loadBashCompletion = `
# Added by DojoCLI
autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
source ${ this.bash_completion }
source ${ this.bashCompletion }
`;
......@@ -92,7 +92,7 @@ source ${ filename }
}
} else {
try {
fs.writeFileSync(path, this.load_bash_completion);
fs.writeFileSync(path, this.loadBashCompletion);
spinner.succeed(`Zsh profile written.`);
} catch ( error ) {
spinner.fail(`Error writing in ${ this.zprofile }`);
......@@ -117,7 +117,7 @@ source ${ filename }
- create a .zprofile or append the appropriate commands into the .zprofile file
*/
protected async commandAction(options: { file: string, force: boolean }): Promise<void> {
const filePath = path.resolve(options.file ?? this.bash_completion); // change that if file is empty
const filePath = path.resolve(options.file ?? this.bashCompletion); // change that if file is empty
const showInstructions = !!options.file;
if ( !(await tryRenameFile(filePath, options.force)) ) { // means renaming was interrupted
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment