You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
attachCommand.Flags().StringVar(&attachFlags.boardFlavour, "flavour", "default", "The Name of the CPU flavour, it is required for some boards (e.g. Arduino Nano).")
56
63
attachCommand.Flags().StringVar(&attachFlags.searchTimeout, "timeout", "5s", "The timeout of the search of connected devices, try to high it if your board is not found (e.g. to 10s).")
64
+
returnattachCommand
57
65
}
58
66
59
67
varattachFlagsstruct {
60
68
boardFlavourstring// The flavour of the chipset of the cpu of the connected board, if not specified it is set to "default".
61
69
searchTimeoutstring// Expressed in a parsable duration, is the timeout for the list and attach commands.
Copy file name to clipboardExpand all lines: commands/board/list.go
+10-11
Original file line number
Diff line number
Diff line change
@@ -17,24 +17,23 @@ import (
17
17
"github.com/spf13/cobra"
18
18
)
19
19
20
-
funcinit() {
21
-
command.AddCommand(listCommand)
20
+
funcinitListCommand() *cobra.Command {
21
+
listCommand:=&cobra.Command{
22
+
Use: "list",
23
+
Short: "List connected boards.",
24
+
Long: "Detects and displays a list of connected boards to the current computer.",
25
+
Example: "arduino board list --timeout 10s",
26
+
Args: cobra.NoArgs,
27
+
Run: runListCommand,
28
+
}
22
29
listCommand.Flags().StringVar(&listFlags.timeout, "timeout", "5s", "The timeout of the search of connected devices, try to high it if your board is not found (e.g. to 10s).")
30
+
returnlistCommand
23
31
}
24
32
25
33
varlistFlagsstruct {
26
34
timeoutstring// Expressed in a parsable duration, is the timeout for the list and attach commands.
27
35
}
28
36
29
-
varlistCommand=&cobra.Command{
30
-
Use: "list",
31
-
Short: "List connected boards.",
32
-
Long: "Detects and displays a list of connected boards to the current computer.",
33
-
Example: "arduino board list --timeout 10s",
34
-
Args: cobra.NoArgs,
35
-
Run: runListCommand,
36
-
}
37
-
38
37
// runListCommand detects and lists the connected arduino boards
Copy file name to clipboardExpand all lines: commands/config/init.go
+12-13
Original file line number
Diff line number
Diff line change
@@ -39,28 +39,27 @@ import (
39
39
"github.com/spf13/cobra"
40
40
)
41
41
42
-
funcinit() {
43
-
command.AddCommand(initCommand)
42
+
funcinitInitCommand() *cobra.Command {
43
+
initCommand:=&cobra.Command{
44
+
Use: "init",
45
+
Short: "Initializes a new config file into the default location.",
46
+
Long: "Initializes a new config file into the default location ($EXE_DIR/cli-config.yml).",
47
+
Example: ""+
48
+
"arduino config init # Creates a config file by asking questions to the user into the default location.\n"+
49
+
"arduino config init --default # Creates a config file with default configuration into default location.",
50
+
Args: cobra.NoArgs,
51
+
Run: runInitCommand,
52
+
}
44
53
initCommand.Flags().BoolVar(&initFlags._default, "default", false, "If omitted, ask questions to the user about setting configuration properties, otherwise use default configuration.")
45
54
initCommand.Flags().StringVar(&initFlags.location, "save-as", "", "Sets where to save the configuration file [default is ./.cli-config.yml].")
55
+
returninitCommand
46
56
}
47
57
48
58
varinitFlagsstruct {
49
59
_defaultbool// If false, ask questions to the user about setting configuration properties, otherwise use default configuration.
50
60
locationstring// The custom location of the file to create.
51
61
}
52
62
53
-
varinitCommand=&cobra.Command{
54
-
Use: "init",
55
-
Short: "Initializes a new config file into the default location.",
56
-
Long: "Initializes a new config file into the default location ($EXE_DIR/cli-config.yml).",
57
-
Example: ""+
58
-
"arduino config init # Creates a config file by asking questions to the user into the default location.\n"+
59
-
"arduino config init --default # Creates a config file with default configuration into default location.",
0 commit comments