-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor flash and update to share more code. #567
Conversation
Short: "Update the firmware on a Jaguar device", | ||
Long: "Update the firmware on a Jaguar device via WiFi. The device name and\n" + | ||
"id are preserved across the operation.", | ||
Use: "update [envelope]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much no change in this file, except that the shared code has been moved out and the areas I added a comment to (in the PR).
cmd.Flags().MarkHidden("uart-endpoint-rx") | ||
cmd.Flags().Uint("uart-endpoint-baud", 0, "set the baud rate for the UART endpoint") | ||
cmd.Flags().MarkHidden("uart-endpoint-baud") | ||
addFirmwareFlashFlags(cmd, "", "new name of the device, if given") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have the option of changing the name.
"id are preserved across the operation.", | ||
Use: "update [envelope]", | ||
Short: "Update the firmware on a Jaguar device", | ||
Long: "Update the firmware on a Jaguar device via WiFi", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the help, since the ID was already changing, and we now have a way to change the name.
} | ||
|
||
func withFirmware(cmd *cobra.Command, args []string, device Device, fun callback) error { | ||
ctx := cmd.Context() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this code was copied out from firmware.go and flash.go.
if device != nil { | ||
chip = device.Chip() | ||
} else { | ||
return fmt.Errorf("chip type must be specified") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change here: the old flash command had the message "auto isn't implemented yet".
return fun(id.String(), envelopeFile, config) | ||
} | ||
|
||
func BuildFirmwareEnvelope(ctx context.Context, envelope EnvelopeOptions, device DeviceOptions, uartEndpointOptions map[string]interface{}) (*os.File, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anything below this line is copied verbatim without any change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
No description provided.