Infer flash target for single bare bin#10
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR closes a CLI UX gap in cfcli bootload flash by allowing a single bare --bin <file> to be associated with a single explicit --targets <target> value, avoiding an interactive target prompt when the intent is unambiguous.
Changes:
- Add logic to infer the flash target when
--bincontains exactly one bare file and--targetscontains exactly one target. - Keep existing interactive prompt / error behavior for ambiguous cases (multiple bins or multiple targets).
- Document the new non-interactive single-bin/single-target usage and fix typos in the bootload docs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main.rs | Adds a helper + unit tests and uses it to infer a target for a single bare --bin entry when --targets is a single value. |
| docs/bootload.md | Documents --bin <file> --targets <target> usage and corrects “promt” → “prompt”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
stefanthorstenson
requested changes
Jun 23, 2026
stefanthorstenson
left a comment
There was a problem hiding this comment.
Nice addition! Tested and confirmed functionality with
$ cargo run bootload flash --bin /home/stefan/code/bitcraze/crazyflie-firmware/build/cf21bl.bin --targets stm32-fw
One review comment.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
stefanthorstenson
approved these changes
Jun 23, 2026
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.
There is a hole in the cli ux: there is no way, from command line, to specify a single binary and a target for this binary. For example the followin still display an interactive target choice: `cfcli bootload flash --targets bcLighthouse4-fw --bin lighthouse.bin'.
This PR enables the syntax above, making it work as expected: equivalent to choosing
bcLighthouse4-fwin the interactive list.Summary
--binfile target from a single explicit--targetsvalue.Test Plan
cargo test --quiet && cargo check --quiet