diff --git a/cmd/list.go b/cmd/list.go index 3ab9ff0..d7bae22 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -2,7 +2,9 @@ package cmd import ( "fmt" + "os" + "github.com/mattn/go-isatty" "github.com/spf13/cobra" "github.com/codekoala/go-aws-lanes" @@ -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) } diff --git a/glide.lock b/glide.lock index 2f69dfc..62889ff 100644 --- a/glide.lock +++ b/glide.lock @@ -1,12 +1,12 @@ -hash: 0b210a7b7099359df378e3b6ab72aeadf4a6b24b8e60f125789c180f42cd4d5f -updated: 2017-10-31T23:21:04.363061497-04:00 +hash: 1bb461bb51f03c0135b1f6773b165ca2bfabacecd3befc99cfda7eebc492920f +updated: 2017-11-06T15:09:00.373613767-05:00 imports: - name: github.com/apcera/termtables version: bcbc5dc54055d14996b256d348fb75cc6debe282 subpackages: - term - name: github.com/aws/aws-sdk-go - version: ee1f179877b2daf2aaabf71fa900773bf8842253 + version: d46843b92a3a8e377d7fe24b4d70fca37f923d00 subpackages: - aws - aws/awserr @@ -51,8 +51,7 @@ imports: version: 5411d3eea5978e6cdc258b30de592b60df6aba96 repo: https://github.com/mattn/go-colorable - name: github.com/mattn/go-isatty - version: 57fdcb988a5c543893cc61bce354a6e24ab70022 - repo: https://github.com/mattn/go-isatty + version: 0360b2af4f38e8d38c7fce2a9f4e702702d73a39 - name: github.com/mattn/go-runewidth version: 14207d285c6c197daabb5c9793d63e7af9ab2d50 repo: https://github.com/mattn/go-runewidth diff --git a/glide.yaml b/glide.yaml index 7748d20..3ad0093 100644 --- a/glide.yaml +++ b/glide.yaml @@ -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 diff --git a/version/version.go b/version/version.go index b20de88..d3de050 100644 --- a/version/version.go +++ b/version/version.go @@ -6,7 +6,7 @@ import ( ) var ( - Version = "v0.3.0" + Version = "v0.3.1" Commit = "dev" BuildDate string )