duckctl: scp, with :path for the robot - #269
Merged
Merged
Conversation
Coverage71.73% lines on this branch, against a floor of 70%. Per-file |
`duckctl ssh` already resolves the robot's address and hands the terminal over; copying a file off a robot still meant `scp radxa@$(duckctl ip):…`, which is the substitution `ssh` exists to remove. The robot side is `scp`'s own `host:path` with the host left out, so `duckctl scp report.md :/tmp/` sends one up and `duckctl scp :/var/log/robotd.log .` brings one down. The rewrite is textual and only ever looks at the first character, which is what keeps `-r`, `-P 2222`, several sources and a path with a colon in the middle of it working without this tool having to understand any of them. Both directions, then, out of one command that answers to the name people reach for — rather than a `push` and a `pull` that nobody typing `scp` would find. A copy with no `:` anywhere in it is refused before the radio is turned on. `scp` performs that copy happily, locally, and nothing in its output says the robot was never involved; refusing it after the scan would also charge eight seconds for the diagnosis. The `exec` that makes `ssh` become `ssh` is now `become_program`, shared by both, so the progress meter, the key prompts and the exit status are `scp`'s own for the same reason they were ssh's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
pierre-rouanet
force-pushed
the
duckctl-scp
branch
from
September 10, 2026 15:37
68fc6d4 to
773a67d
Compare
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.
duckctl sshfinds the robot and hands the terminal tossh. Copying a file still meantscp radxa@$(duckctl ip):/var/log/robotd.log .— the substitutionsshexists to remove.duckctl scp :/var/log/robotd.log .A path starting with
:is on the robot:scp's ownhost:pathwith the host left out, becausethe host is what this finds for you. The rewrite is textual and only ever looks at the first
character, so
-r,-P 2222, several sources, a bare:for the home directory and a path with acolon in the middle of it all reach
scpexactly as typed —scpdecides what they mean.That is why it is one command rather than a
pushand apull: both directions, under the namesomebody reaching for
scpwould actually type.A copy with no
:anywhere in it is refused before the scan.scpwould perform it — locally,happily — and nothing in the output would say the robot was never involved; refusing it after the
scan would charge eight seconds for the diagnosis too.
The account resolves the way
ssh's does:--user, elseDUCK_BOARD_USER, elseradxa. Theexecthat makessshbecomesshis nowbecome_program, shared by both, so the progress meter,the key prompts and the exit status are
scp's own.Checked
Both directions against olducky, over a real BLE resolve:
and the file came back with its contents.
duckctl scp a brefuses in 0.4 s with no scan. Threenew unit tests cover the rewrite, the two refusals and the parse;
cargo test -p duckctlis 49green, clippy and fmt clean.
🤖 Generated with Claude Code