Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cmd/dbc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ type cmds struct {
Docs *DocsCmd `arg:"subcommand" help:"Open driver documentation in a web browser"`
Remove *RemoveCmd `arg:"subcommand" help:"Remove a driver from the driver list"`
Completion *completions.Cmd `arg:"subcommand" help:"-"`
Quiet bool `arg:"-q,--quiet" help:"Suppress all output"`
}

func (cmds) Version() string {
Expand Down Expand Up @@ -197,17 +198,22 @@ func main() {

if !isatty.IsTerminal(os.Stdout.Fd()) {
prog = tea.NewProgram(m, tea.WithoutRenderer(), tea.WithInput(nil))
} else if args.Quiet {
// Quiet still prints stderr as GNU standard is to supress "usual" output
prog = tea.NewProgram(m, tea.WithoutRenderer(), tea.WithInput(nil), tea.WithOutput(os.Stderr))
} else {
prog = tea.NewProgram(m)
}

if m, err = prog.Run(); err != nil {
fmt.Println("Error running program:", err)
fmt.Fprintln(os.Stderr, "Error running program:", err)
os.Exit(1)
}

if fo, ok := m.(HasFinalOutput); ok {
fmt.Print(fo.FinalOutput())
if !args.Quiet {
if fo, ok := m.(HasFinalOutput); ok {
fmt.Print(fo.FinalOutput())
}
}

if h, ok := m.(HasStatus); ok {
Expand Down
40 changes: 40 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ $ dbc search [FILTER]

: Enable verbose output

`--quiet`, `-q`

: Suppress all output

## install

Install a driver.
Expand Down Expand Up @@ -98,6 +102,10 @@ $ dbc install [OPTIONS] <DRIVER>

: Allow installation of drivers without a signature file

`--quiet`, `-q`

: Suppress all output

## uninstall

Uninstall a driver.
Expand All @@ -120,6 +128,10 @@ $ dbc uninstall [OPTIONS] <DRIVER>

: The configuration level to uninstall the driver from (`user`, or `system`). See [Config Level](config_level.md).

`--quiet`, `-q`

: Suppress all output

## init

Create a [driver list](../concepts/driver_list.md) file.
Expand All @@ -136,6 +148,12 @@ $ dbc init [PATH]

: Optional. A path to create a [driver list](../concepts/driver_list.md) under. Defaults to the current working directory.

<h3>Options</h3>

`--quiet`, `-q`

: Suppress all output

## add

Add a driver to a current [driver list](../concepts/driver_list.md).
Expand All @@ -158,6 +176,10 @@ $ dbc add <DRIVER>

: Driver list to add to [default: ./dbc.toml]

`--quiet`, `-q`

: Suppress all output

## remove

Remove a driver from the current [driver list](../concepts/driver_list.md).
Expand All @@ -180,6 +202,10 @@ $ dbc remove <DRIVER>

: Driver list to remove from [default: ./dbc.toml]

`--quiet`, `-q`

: Suppress all output

## sync

Install drivers from a [driver list](../concepts/driver_list.md).
Expand Down Expand Up @@ -207,6 +233,10 @@ dbc sync --file dbc.toml

: Allow installation of drivers without a signature file

`--quiet`, `-q`

: Suppress all output

## info

Get information about a driver. Shows information about the latest version of the driver with the given name.
Expand All @@ -223,6 +253,12 @@ $ dbc info <DRIVER>

: Name of the driver to get information for.

<h3>Options</h3>

`--quiet`, `-q`

: Suppress all output

## docs

Open driver documentation in a web browser. If no driver is specified, opens the general dbc documentation. If a driver name is provided, opens the documentation for that specific driver.
Expand All @@ -245,3 +281,7 @@ $ dbc docs <DRIVER>
`--no-open`

: Print the documentation URL instead of opening it in a browser

`--quiet`, `-q`

: Suppress all output
Loading