Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/cliffy/command/completions/bash.ts

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
File
import { Command } from "../command.ts";import { dim, italic } from "../deps.ts";import { BashCompletionsGenerator } from "./_bash_completions_generator.ts";
/** Generates bash completions script. */export class BashCompletionsCommand extends Command { #cmd?: Command; public constructor(cmd?: Command) { super(); this.#cmd = cmd; return this .description(() => { const baseCmd = this.#cmd || this.getMainCommand(); return `Generate shell completions for bash.
To enable bash completions for this program add following line to your ${ dim(italic("~/.bashrc")) }:
${dim(italic(`source <(${baseCmd.getPath()} completions bash)`))}`; }) .action(() => { const baseCmd = this.#cmd || this.getMainCommand(); console.log(BashCompletionsGenerator.generate(baseCmd)); }); }}