Skip to content

Commit

Permalink
Add generic knob parsing for fdbcli (#297)
Browse files Browse the repository at this point in the history
* add generic knob parsing for fdbcli

* fix spacing and add to fdbcli_test.go
  • Loading branch information
sfc-gh-jfu authored Sep 1, 2023
1 parent 09d6ddb commit f1f41c7
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 111 deletions.
8 changes: 7 additions & 1 deletion services/fdb/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (p *fdbCLICmd) Synopsis() string {
return "Run a fdbcli command on the given host.\n" + client.GenerateSynopsis(p.GetSubpackage(flag.NewFlagSet("", flag.ContinueOnError)), 4)
}
func (p *fdbCLICmd) Usage() string {
return `fdbcli [--cluster-file|-C=X] [--log] [--trace-format=X] [–-tls_certificate_file=X] [–-tls_ca_file=X] [–-tls_key_file=X] [–-tls_password=X] [--tls_verify_peers=X] [--debug-tls] [--version|-v] [--log-group=X] [--no-status] [--memory=X] [--build-flags] [--timeout=N] [--status-from-json] --exec "<command> <options>"
return `fdbcli [--cluster-file|-C=X] [--log] [--trace-format=X] [–-tls_certificate_file=X] [–-tls_ca_file=X] [–-tls_key_file=X] [–-tls_password=X] [--tls_verify_peers=X] [--debug-tls] [--version|-v] [--log-group=X] [--no-status] [--memory=X] [--build-flags] [--timeout=N] [--status-from-json] [--knobs=X] --exec "<command> <options>"
Run fdbcli for the given command with specified top level flags as well as any command specific flags.
Expand Down Expand Up @@ -315,6 +315,12 @@ func (r *fdbCLICmd) SetFlags(f *flag.FlagSet) {
}
return nil
})
f.Func("knobs", "knobs for fdbcli, comma-separated in the form <knob_name1>=<knob_value1>,<knob_name2>=<knob_value2>,...", func(s string) error {
r.req.Knobs = &wrapperspb.StringValue{
Value: s,
}
return nil
})
}

// Execute acts like the top level fdbCmd does and delegates actual execution to the parsed sub-command.
Expand Down
Loading

0 comments on commit f1f41c7

Please sign in to comment.