Skip to content

Commit 0a42661

Browse files
committed
Improve error message when port or fqbn flags are missing
1 parent d474176 commit 0a42661

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

cli/cli_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func TestCompileCommandsIntegration(t *testing.T) {
309309
// Build sketch without FQBN
310310
exitCode, d = executeWithArgs("compile", test1)
311311
require.NotZero(t, exitCode)
312-
require.Contains(t, string(d), "no FQBN provided")
312+
require.Contains(t, string(d), "required flag(s) \"fqbn\" not set")
313313

314314
// Build sketch for arduino:avr:uno
315315
exitCode, d = executeWithArgs("compile", "-b", "arduino:avr:uno", test1)

cli/compile/compile.go

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ func NewCommand() *cobra.Command {
8080
command.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.")
8181
command.Flags().StringVar(&vidPid, "vid-pid", "", "When specified, VID/PID specific build properties are used, if boards supports them.")
8282

83+
command.MarkFlagRequired("fqbn")
84+
8385
return command
8486
}
8587

cli/upload/upload.go

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ func NewCommand() *cobra.Command {
5656
uploadCommand.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.")
5757
uploadCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, "Optional, turns on verbose mode.")
5858

59+
uploadCommand.MarkFlagRequired("fqbn")
60+
uploadCommand.MarkFlagRequired("port")
61+
5962
return uploadCommand
6063
}
6164

0 commit comments

Comments
 (0)