diff options
| author | Paul Buetow <paul@buetow.org> | 2021-09-18 14:41:25 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-02 12:26:29 +0300 |
| commit | 6506e20f6c80f4acb7434eb9dd14f784a67189cd (patch) | |
| tree | 1554831a5468729aa48c0baf3d5c9a78a8499288 /cmd/dgrep/main.go | |
| parent | 7fbea88cf55af9b3354b4a1334e49c38d0d920fc (diff) | |
add spartan mode
Diffstat (limited to 'cmd/dgrep/main.go')
| -rw-r--r-- | cmd/dgrep/main.go | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/cmd/dgrep/main.go b/cmd/dgrep/main.go index 35b2236..7b96472 100644 --- a/cmd/dgrep/main.go +++ b/cmd/dgrep/main.go @@ -4,7 +4,6 @@ import ( "context" "flag" "os" - "strings" "github.com/mimecast/dtail/internal/clients" "github.com/mimecast/dtail/internal/config" @@ -21,17 +20,17 @@ func main() { var debugEnable bool var displayVersion bool var grep string - var noColor bool var sshPort int userName := user.Name() + flag.BoolVar(&args.Quiet, "quiet", false, "Quiet output mode") flag.BoolVar(&args.RegexInvert, "invert", false, "Invert regex") + flag.BoolVar(&args.Spartan, "spartan", false, "Spartan output mode") flag.BoolVar(&args.TrustAllHosts, "trustAllHosts", false, "Auto trust all unknown host keys") flag.BoolVar(&debugEnable, "debug", false, "Activate debug messages") flag.BoolVar(&displayVersion, "version", false, "Display version") - flag.BoolVar(&noColor, "noColor", false, "Disable ANSII terminal colors") - flag.BoolVar(&args.Quiet, "quiet", false, "Quiet output mode") + flag.BoolVar(&args.NoColor, "noColor", false, "Disable ANSII terminal colors") flag.IntVar(&args.ConnectionsPerCPU, "cpc", 10, "How many connections established per CPU core concurrently") flag.IntVar(&sshPort, "port", 2222, "SSH server port") flag.StringVar(&args.Discovery, "discovery", "", "Server discovery method") @@ -44,25 +43,16 @@ func main() { flag.StringVar(&grep, "grep", "", "Alias for -regex") flag.Parse() - - if args.What == "" { - // Interpret additional args as file list. - var files []string - for _, file := range flag.Args() { - files = append(files, file) - } - args.What = strings.Join(files, ",") - } - - config.Read(cfgFile, sshPort) - if noColor { - config.Client.TermColorsEnable = false - } + args.Transform(flag.Args()) + config.Read(cfgFile, sshPort, args.NoColor) + args.TransformAfterConfigFile() if displayVersion { version.PrintAndExit() } - version.Print() + if !args.Spartan { + version.Print() + } ctx := context.TODO() logger.Start(ctx, logger.Modes{ |
