Select Git revision
CompletionBashCommand.ts

michael.minelli authored
CompletionBashCommand.ts 802 B
import CommanderCommand from '../../CommanderCommand';
import path from 'path';
import os from 'os';
import { updateRcFile } from '../../../helpers/AutoCompletionHelper';
class CompletionBashCommand extends CommanderCommand {
protected commandName: string = 'bash';
private readonly bashrcPath = path.join(os.homedir(), '.bashrc');
private readonly completionCommand = `
# Added by DojoCLI
source <(dojo completion script bash)
`;
protected defineCommand() {
this.command.description('generate bash completion')
.action(this.commandAction.bind(this));
}
protected async commandAction(): Promise<void> {
updateRcFile('bash', this.bashrcPath, this.completionCommand);
}
}
export default new CompletionBashCommand();