Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add kitexcall version #11

Merged
merged 8 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/argparse/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func (a *Argument) buildFlags() *flag.FlagSet {

f.BoolVar(&a.MetaBackward, "meta-backward", false, "Enable receiving backward metainfo from server.")

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

return f
}

Expand All @@ -126,6 +128,11 @@ func (a *Argument) ParseArgs() error {

a.PreJudge(f)

if a.Version {
fmt.Printf("kitexcall version %s\n", config.Version)
os.Exit(0)
}

log.Verbose = a.Verbose
log.Info("Parse args succeed")

Expand Down Expand Up @@ -270,6 +277,7 @@ func (a *Argument) BuildConfig() *config.Config {
MetaPersistent: a.MetaPersistent,
MetaBackward: a.MetaBackward,
BizError: a.BizError,
Version: a.Version,
GuangmingLuo marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ const (
TTHeaderFramed string = "TTHeaderFramed"
)

//kitexcall version
const (
Version string = "0.1.1"
)

Zzhiter marked this conversation as resolved.
Show resolved Hide resolved
// We provide a general configuration
// so that it can be utilized by others apart from kitexcall.
type Config struct {
Expand All @@ -46,6 +51,7 @@ type Config struct {
MetaPersistent map[string]string
MetaBackward bool
BizError bool
Version bool
Zzhiter marked this conversation as resolved.
Show resolved Hide resolved
}

type ConfigBuilder interface {
Expand Down
Loading