Skip to content

Commit

Permalink
feat: add quiet flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rfyiamcool committed Oct 23, 2024
1 parent e6b232e commit 8c590db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/argparse/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func (a *Argument) buildFlags() *flag.FlagSet {

f.BoolVar(&a.version, "version", false, "Show the version of kitexcall.")

f.BoolVar(&a.Quiet, "quiet", false, "Enable only print rpc response.")

return f
}

Expand Down Expand Up @@ -279,6 +281,7 @@ func (a *Argument) BuildConfig() *config.Config {
MetaPersistent: a.MetaPersistent,
MetaBackward: a.MetaBackward,
BizError: a.BizError,
Quiet: a.Quiet,
}
}

Expand Down
7 changes: 5 additions & 2 deletions pkg/client/generic_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package client

import (
"context"
"fmt"
"os"

"github.com/bytedance/gopkg/cloud/metainfo"
Expand Down Expand Up @@ -83,8 +84,10 @@ func (c *GenericClientBase) Output() error {
return err
}

log.Success()
log.Println(result)
if !c.Conf.Quiet {
log.Success()
}
fmt.Print(result)

if c.Conf.MetaBackward {
log.Println("\033[32mReceived metainfo from server: \033[0m")
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type Config struct {
MetaPersistent map[string]string
MetaBackward bool
BizError bool
Quiet bool
}

type ConfigBuilder interface {
Expand Down

0 comments on commit 8c590db

Please sign in to comment.