Commit 7373b097 authored by Cristian Maglie's avatar Cristian Maglie

Restored timeout flag in 'board list'

parent 14186ed4
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"os" "os"
"sort" "sort"
"time"
"github.com/arduino/arduino-cli/cli" "github.com/arduino/arduino-cli/cli"
"github.com/arduino/arduino-cli/commands/board" "github.com/arduino/arduino-cli/commands/board"
...@@ -41,7 +42,7 @@ func initListCommand() *cobra.Command { ...@@ -41,7 +42,7 @@ func initListCommand() *cobra.Command {
Run: runListCommand, Run: runListCommand,
} }
listCommand.Flags().StringVar(&listFlags.timeout, "timeout", "1s", listCommand.Flags().StringVar(&listFlags.timeout, "timeout", "0s",
"The timeout of the search of connected devices, try to increase it if your board is not found (e.g. to 10s).") "The timeout of the search of connected devices, try to increase it if your board is not found (e.g. to 10s).")
return listCommand return listCommand
} }
...@@ -54,11 +55,12 @@ var listFlags struct { ...@@ -54,11 +55,12 @@ var listFlags struct {
func runListCommand(cmd *cobra.Command, args []string) { func runListCommand(cmd *cobra.Command, args []string) {
instance := cli.CreateInstance() instance := cli.CreateInstance()
// timeout, err := time.ParseDuration(listFlags.timeout) if timeout, err := time.ParseDuration(listFlags.timeout); err != nil {
// if err != nil { formatter.PrintError(err, "Invalid timeout.")
// formatter.PrintError(err, "Invalid timeout.") os.Exit(cli.ErrBadArgument)
// os.Exit(cli.ErrBadArgument) } else {
// } time.Sleep(timeout)
}
resp, err := board.BoardList(context.Background(), &rpc.BoardListReq{Instance: instance}) resp, err := board.BoardList(context.Background(), &rpc.BoardListReq{Instance: instance})
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment