Skip to content

Commit f61b73f

Browse files
authored
chore: remove board sub-command (#27)
* chore: remove board sub-command * fix go.mod
1 parent 976fa3c commit f61b73f

File tree

4 files changed

+26
-315
lines changed

4 files changed

+26
-315
lines changed

cmd/arduino-app-cli/board/board.go

Lines changed: 0 additions & 306 deletions
This file was deleted.

cmd/arduino-app-cli/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"go.bug.st/cleanup"
2626

2727
"github.com/arduino/arduino-app-cli/cmd/arduino-app-cli/app"
28-
"github.com/arduino/arduino-app-cli/cmd/arduino-app-cli/board"
2928
"github.com/arduino/arduino-app-cli/cmd/arduino-app-cli/brick"
3029
"github.com/arduino/arduino-app-cli/cmd/arduino-app-cli/completion"
3130
"github.com/arduino/arduino-app-cli/cmd/arduino-app-cli/config"
@@ -78,7 +77,6 @@ func run(configuration cfg.Configuration) error {
7877
properties.NewPropertiesCmd(configuration),
7978
config.NewConfigCmd(configuration),
8079
system.NewSystemCmd(configuration),
81-
board.NewBoardCmd(),
8280
version.NewVersionCmd(Version),
8381
)
8482

cmd/arduino-app-cli/system/system.go

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,17 @@ func NewSystemCmd(cfg config.Configuration) *cobra.Command {
4040
Use: "system",
4141
}
4242

43-
cmd.AddCommand(newDownloadImage(cfg))
43+
cmd.AddCommand(newDownloadImageCmd(cfg))
4444
cmd.AddCommand(newUpdateCmd())
4545
cmd.AddCommand(newCleanUpCmd(cfg, servicelocator.GetDockerClient()))
46-
cmd.AddCommand(newNetworkMode())
47-
cmd.AddCommand(newkeyboardSet())
46+
cmd.AddCommand(newNetworkModeCmd())
47+
cmd.AddCommand(newKeyboardSetCmd())
48+
cmd.AddCommand(newBoardSetNameCmd())
4849

4950
return cmd
5051
}
5152

52-
func newDownloadImage(cfg config.Configuration) *cobra.Command {
53+
func newDownloadImageCmd(cfg config.Configuration) *cobra.Command {
5354
cmd := &cobra.Command{
5455
Use: "init",
5556
Args: cobra.ExactArgs(0),
@@ -173,7 +174,7 @@ func newCleanUpCmd(cfg config.Configuration, docker command.Cli) *cobra.Command
173174
return cmd
174175
}
175176

176-
func newNetworkMode() *cobra.Command {
177+
func newNetworkModeCmd() *cobra.Command {
177178
cmd := &cobra.Command{
178179
Use: "network-mode <enable|disable|status>",
179180
Short: "Manage the network mode of the system",
@@ -209,7 +210,7 @@ func newNetworkMode() *cobra.Command {
209210
return cmd
210211
}
211212

212-
func newkeyboardSet() *cobra.Command {
213+
func newKeyboardSetCmd() *cobra.Command {
213214
cmd := &cobra.Command{
214215
Use: "keyboard [layout]",
215216
Short: "Manage the keyboard layout of the system",
@@ -250,3 +251,21 @@ func newkeyboardSet() *cobra.Command {
250251

251252
return cmd
252253
}
254+
255+
func newBoardSetNameCmd() *cobra.Command {
256+
setNameCmd := &cobra.Command{
257+
Use: "set-name <name>",
258+
Short: "Set the custom name of the board",
259+
Args: cobra.ExactArgs(1),
260+
RunE: func(cmd *cobra.Command, args []string) error {
261+
name := args[0]
262+
if err := board.SetCustomName(cmd.Context(), &local.LocalConnection{}, name); err != nil {
263+
return fmt.Errorf("failed to set custom name: %w", err)
264+
}
265+
feedback.Printf("Custom name set to %q\n", name)
266+
return nil
267+
},
268+
}
269+
270+
return setNameCmd
271+
}

0 commit comments

Comments
 (0)