Skip to content

Commit

Permalink
Implement fdbcli missing commands (#137)
Browse files Browse the repository at this point in the history
* Add missing fdbcli commands (10)

Realized that transaction isn't needed as it's own message. Instead we simply take one or more commands and then chain them together with exec.

Implement begin and commit so transactions will work in this fashion.

Fix kill (it has options I missed).

Add tests for everything.

* Add a multi-command test

* Refactor to account for N commands separated by semicolon and new Request structure.

Also fix Kill since we changed it's proto struct as well.

TODO: Remaining new commands and some sanity testing for N commands.

* regen

* Implement all the remaining missing CLI commands.

Standardize usage

Fix help/flags/commands to work correctly.

Rename fdbcli help to fdbclihelp as we have a conflict otherwise.

* Make sure for basic top level help/flags/commands we still pass an execute state.

* Fix tabwriter so the output actually looks good when we're nested a bit.

* Update reserved syntax to actual proto3 style

* Add default cases for internal oneof's so we error if one gets added we don't handle

* Remove transaction. it's no longer a distinct message

* Rewrite parse loop to be a lot cleaner
  • Loading branch information
sfc-gh-jchacon authored Jun 16, 2022
1 parent b8a2cd4 commit aeb4cdd
Show file tree
Hide file tree
Showing 8 changed files with 10,019 additions and 4,148 deletions.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func SetupSubpackage(name string, f *flag.FlagSet) *subcommands.Commander {
// unless you're a subcommand of a subcommand and then you'll want more.
func GenerateSynopsis(c *subcommands.Commander, leading int) string {
b := &bytes.Buffer{}
w := tabwriter.NewWriter(b, 2, 8, 2, '\t', 0)
w := tabwriter.NewWriter(b, 8, 0, 2, ' ', 0)
w.Write([]byte("\n"))
fn := func(c *subcommands.CommandGroup, comm subcommands.Command) {
switch comm.Name() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/sanssh/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Run(ctx context.Context, rs RunState) {
for _, f := range flag.Args() {
switch f {
case "help", "flags", "commands":
os.Exit(int(subcommands.Execute(ctx)))
os.Exit(int(subcommands.Execute(ctx, &util.ExecuteState{})))
}
}

Expand Down
Loading

0 comments on commit aeb4cdd

Please sign in to comment.