Skip to content

chore: fix the output of etcdctl watch -i #19397

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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: 4 additions & 4 deletions etcdctl/ctlv3/command/watch_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@

args := Argify(l)
if len(args) < 1 {
fmt.Fprintf(os.Stderr, "Invalid command: %s (watch and progress supported)\n", l)
fmt.Fprintf(os.Stderr, "Invalid command: '%s' (only `watch` and `progress` are supported)\n", l)

Check warning on line 108 in etcdctl/ctlv3/command/watch_command.go

View check run for this annotation

Codecov / codecov/patch

etcdctl/ctlv3/command/watch_command.go#L108

Added line #L108 was not covered by tests
continue
}
switch args[0] {
case "watch":
if len(args) < 2 && envKey == "" {
fmt.Fprintf(os.Stderr, "Invalid command %s (command type or key is not provided)\n", l)
fmt.Fprintf(os.Stderr, "Invalid command: '%s' (the key/prefix is not provided)\n", l)

Check warning on line 114 in etcdctl/ctlv3/command/watch_command.go

View check run for this annotation

Codecov / codecov/patch

etcdctl/ctlv3/command/watch_command.go#L114

Added line #L114 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not correct. If you read parseWatchArgs, the args may not just be key/prefix.

continue
}
watchArgs, execArgs, perr := parseWatchArgs(osArgs, args, envKey, envRange, true)
Expand All @@ -121,7 +121,7 @@

ch, err := getWatchChan(c, watchArgs)
if err != nil {
fmt.Fprintf(os.Stderr, "Invalid command %s (%v)\n", l, err)
fmt.Fprintf(os.Stderr, "Invalid command: '%s' (%v)\n", l, err)

Check warning on line 124 in etcdctl/ctlv3/command/watch_command.go

View check run for this annotation

Codecov / codecov/patch

etcdctl/ctlv3/command/watch_command.go#L124

Added line #L124 was not covered by tests
continue
}
go printWatchCh(c, ch, execArgs)
Expand All @@ -131,7 +131,7 @@
cobrautl.ExitWithError(cobrautl.ExitError, err)
}
default:
fmt.Fprintf(os.Stderr, "Invalid command %s (only support watch)\n", l)
fmt.Fprintf(os.Stderr, "Invalid command: '%s' (only `watch` and `progress` are supported)\n", l)

Check warning on line 134 in etcdctl/ctlv3/command/watch_command.go

View check run for this annotation

Codecov / codecov/patch

etcdctl/ctlv3/command/watch_command.go#L134

Added line #L134 was not covered by tests
continue
}
}
Expand Down