Skip to content

Commit

Permalink
refactor(command): remove duplication description from completions co…
Browse files Browse the repository at this point in the history
…mmand (#118)
  • Loading branch information
c4spar committed Nov 27, 2020
1 parent f4ca0bb commit d116c73
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions command/completions/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@ export class CompletionsCommand extends Command {
public constructor(cmd?: Command) {
super();
this.#cmd = cmd;
this.description("Generate shell completions.")
.description(() => {
const baseCmd = this.#cmd || this.getMainCommand();
return `Generate shell completions.
this.description(() => {
const baseCmd = this.#cmd || this.getMainCommand();
return `Generate shell completions.
To enable shell completions for this program add following line to your ${
dim(italic("~/.bashrc"))
} or similar:
dim(italic("~/.bashrc"))
} or similar:
${dim(italic(`source <(${baseCmd.getPath()} completions [shell])`))}
For mor information run ${
dim(italic(`${baseCmd.getPath()} completions [shell] --help`))
}
dim(italic(`${baseCmd.getPath()} completions [shell] --help`))
}
`;
})
})
.action(() => this.help())
.command("bash", new BashCompletionsCommand(this.#cmd))
.command("fish", new FishCompletionsCommand(this.#cmd))
Expand Down

0 comments on commit d116c73

Please sign in to comment.