Feat: default list and auto resolve#332
Open
RiSKeD wants to merge 5 commits into
Open
Conversation
Split the RPC selection logic out of start() into a new dispatch() method that returns an error. Behavior is unchanged: start() still calls app.exit() with the result. The split makes the dispatch decision tree testable without driving os.Exit. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
Hand-written fake DeviceServiceClient (Run is intentionally unimplemented since the streaming path is not exercised). Table-driven cases lock in current behavior for the list/commands/details paths before introducing the no-args and single-device auto-resolve features. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
Previously `dutctl -s host:port` errored with "invalid command line" and printed usage. The list RPC is the obvious default — show what devices the dutagent has — so dispatch to it when no positional args are given. Note: a no-args invocation against an unreachable dutagent now surfaces the connect.RPC error from List instead of the usage banner. That is more informative; the usage banner is still available via -h. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
Most dutagents host a single device, so requiring the user to repeat the device name on every invocation is friction with no benefit. Add a silent List RPC before dispatch: when the dutagent advertises exactly one device and the first arg is not that device, prepend the device name to the args. An explicit device argument always wins. Failure modes (List RPC fails, zero or multiple devices) leave args untouched so the subsequent RPC produces a meaningful user-facing error. Trade-off: one extra round trip per non-list, non-version invocation. Sub-ms on LAN, ~1xRTT on slow links. Acceptable for the UX gain; a future opt-out flag can be added if needed. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
Add the bare `dutctl [options]` form to the synopsis and two sentences to the description covering the new default and auto-resolve behavior. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #293