@@ -35,14 +35,12 @@ import (
3535)
3636
3737var (
38- fqbn string
38+ fqbn arguments. Fqbn
3939 port arguments.Port
40- verbose bool
41- verify bool
4240 interpreter string
4341 importDir string
4442 printInfo bool
45- programmer string
43+ programmer arguments. Programmer
4644 tr = i18n .Tr
4745)
4846
@@ -54,26 +52,20 @@ func NewCommand() *cobra.Command {
5452 Long : tr ("Debug Arduino sketches. (this command opens an interactive gdb session)" ),
5553 Example : " " + os .Args [0 ] + " debug -b arduino:samd:mkr1000 -P atmel_ice /home/user/Arduino/MySketch" ,
5654 Args : cobra .MaximumNArgs (1 ),
57- Run : run ,
55+ Run : runDebugCommand ,
5856 }
5957
60- debugCommand .Flags ().StringVarP (& fqbn , "fqbn" , "b" , "" , tr ("Fully Qualified Board Name, e.g.: arduino:avr:uno" ))
61- debugCommand .RegisterFlagCompletionFunc ("fqbn" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
62- return arguments .GetInstalledBoards (), cobra .ShellCompDirectiveDefault
63- })
58+ fqbn .AddToCommand (debugCommand )
6459 port .AddToCommand (debugCommand )
65- debugCommand .Flags ().StringVarP (& programmer , "programmer" , "P" , "" , tr ("Programmer to use for debugging" ))
66- debugCommand .RegisterFlagCompletionFunc ("programmer" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
67- return arguments .GetInstalledProgrammers (), cobra .ShellCompDirectiveDefault
68- })
60+ programmer .AddToCommand (debugCommand )
6961 debugCommand .Flags ().StringVar (& interpreter , "interpreter" , "console" , tr ("Debug interpreter e.g.: %s" , "console, mi, mi1, mi2, mi3" ))
7062 debugCommand .Flags ().StringVarP (& importDir , "input-dir" , "" , "" , tr ("Directory containing binaries for debug." ))
7163 debugCommand .Flags ().BoolVarP (& printInfo , "info" , "I" , false , tr ("Show metadata about the debug session instead of starting the debugger." ))
7264
7365 return debugCommand
7466}
7567
76- func run (command * cobra.Command , args []string ) {
68+ func runDebugCommand (command * cobra.Command , args []string ) {
7769 instance := instance .CreateAndInit ()
7870
7971 path := ""
@@ -87,12 +79,12 @@ func run(command *cobra.Command, args []string) {
8779
8880 debugConfigRequested := & dbg.DebugConfigRequest {
8981 Instance : instance ,
90- Fqbn : fqbn ,
82+ Fqbn : fqbn . String () ,
9183 SketchPath : sketchPath .String (),
9284 Port : discoveryPort .ToRPC (),
9385 Interpreter : interpreter ,
9486 ImportDir : importDir ,
95- Programmer : programmer ,
87+ Programmer : programmer . String () ,
9688 }
9789
9890 if printInfo {
0 commit comments