github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/display/display_options.go (about) 1 package display 2 3 import ( 4 "github.com/turbot/steampipe/pkg/cmdconfig" 5 "github.com/turbot/steampipe/pkg/constants" 6 ) 7 8 type displayConfiguration struct { 9 timing string 10 } 11 12 // newDisplayConfiguration creates a default configuration with timing set to 13 // true if both --timing is not 'off' and --output is table 14 func newDisplayConfiguration() *displayConfiguration { 15 return &displayConfiguration{ 16 timing: cmdconfig.Viper().GetString(constants.ArgTiming), 17 } 18 } 19 20 type DisplayOption = func(config *displayConfiguration) 21 22 // WithTimingDisabled forcefully disables display of timing data 23 func WithTimingDisabled() DisplayOption { 24 return func(o *displayConfiguration) { 25 o.timing = constants.ArgOff 26 } 27 }