Skip to content

Commit

Permalink
fix: NSID in column mode
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed May 22, 2024
1 parent 699ed57 commit dcb4759
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,18 +491,18 @@ All long form (--) flags can be toggled with the dig-standard +[no]flag notation
Opts: &opts,
}

if opts.NSID && opts.Format == "pretty" {
if opts.NSID && (opts.Format == output.FormatPretty || opts.Format == output.FormatColumn) {
printer.PrettyPrintNSID(entries)
}

switch opts.Format {
case "pretty":
case output.FormatPretty:
printer.PrintPretty(entries)
case "column":
case output.FormatColumn:
printer.PrintColumn(entries)
case "raw":
case output.FormatRAW:
printer.PrintRaw(entries)
case "json", "yml", "yaml":
case output.FormatJSON, output.FormatYAML, "yml":
printer.PrintStructured(entries)
default:
errChan <- fmt.Errorf("invalid output format")
Expand Down
8 changes: 8 additions & 0 deletions output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import (
"github.com/natesales/q/cli"
)

var (
FormatPretty = "pretty"
FormatColumn = "column"
FormatJSON = "json"
FormatYAML = "yaml"
FormatRAW = "raw"
)

// Printer stores global options across multiple entries
type Printer struct {
Out io.Writer
Expand Down

0 comments on commit dcb4759

Please sign in to comment.