Skip to content

Commit

Permalink
Implicitly enable batch mode when piping output
Browse files Browse the repository at this point in the history
  • Loading branch information
codekoala committed Nov 6, 2017
1 parent 404c2cf commit 610f054
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
7 changes: 6 additions & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package cmd

import (
"fmt"
"os"

"github.com/mattn/go-isatty"
"github.com/spf13/cobra"

"github.com/codekoala/go-aws-lanes"
Expand Down Expand Up @@ -52,7 +54,10 @@ var listCmd = &cobra.Command{
parsedColumns = parsedColumns.Remove(hiddenCols...)
}

if batch, _ := fl.GetBool("batch"); batch {
batch, _ := fl.GetBool("batch")
batch = batch || !isatty.IsTerminal(os.Stdout.Fd())

if batch {
lanes.GetConfig().Table.ToggleBatchMode(true)
}

Expand Down
9 changes: 4 additions & 5 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ import:
- ssh/terminal
- package: github.com/hashicorp/go-multierror
- package: github.com/mitchellh/go-homedir
- package: github.com/mattn/go-isatty
version: ^0.0.3
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var (
Version = "v0.3.0"
Version = "v0.3.1"
Commit = "dev"
BuildDate string
)
Expand Down

0 comments on commit 610f054

Please sign in to comment.