Skip to content

Feat: default list and auto resolve#332

Open
RiSKeD wants to merge 5 commits into
mainfrom
feat/dutctl-default-list-and-auto-resolve
Open

Feat: default list and auto resolve#332
RiSKeD wants to merge 5 commits into
mainfrom
feat/dutctl-default-list-and-auto-resolve

Conversation

@RiSKeD
Copy link
Copy Markdown
Contributor

@RiSKeD RiSKeD commented May 13, 2026

resolves #293

RiSKeD added 5 commits May 13, 2026 09:50
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>
@RiSKeD RiSKeD changed the title Feat/dutctl default list and auto resolve Feat: default list and auto resolve May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default behaviour with device selection

1 participant