fix: Handle plain strings in --sync-aliases #25
Merged
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.
First of all, thanks for creating this tool!
Currently,
cargo bin --sync-aliases
panics with a very unhelpful message (unwrap failed) when it encounters an alias defined as a single string. This form is valid and not that uncommon, so users might have that in their config even if cargo-run-bin always creates the array form. I ran into this once myself in the past, fixed it by changing my config.toml, and promptly forgot about it. Until I had to help a colleague debug the same problem a few days ago, so I decided to fix it properly. While I was at it, I also turned other nearby unwrap()s into error messages to avoid similarly bad UX with other unexpected (likely invalid) aliases.