From 8eb380046d35fdc4cb4edfd659c3a879c8bdf1aa Mon Sep 17 00:00:00 2001 From: Roberto Sora Date: Tue, 1 Oct 2019 11:34:24 +0200 Subject: [PATCH 1/3] bump go version in client go.mod --- client_example/go.mod | 2 +- client_example/main.go | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client_example/go.mod b/client_example/go.mod index da515291670..4d3f9b5512f 100644 --- a/client_example/go.mod +++ b/client_example/go.mod @@ -1,6 +1,6 @@ module github.com/arduino/arduino-cli/client_example -go 1.12 +go 1.13 require ( github.com/arduino/arduino-cli v0.0.0-20190826141027-35722fda467d diff --git a/client_example/main.go b/client_example/main.go index 5008efd96fd..3f29dcee3a8 100644 --- a/client_example/main.go +++ b/client_example/main.go @@ -167,7 +167,9 @@ func initInstance(client rpc.ArduinoCoreClient) *rpc.Instance { // the data folder. initRespStream, err := client.Init(context.Background(), &rpc.InitReq{ Configuration: &rpc.Configuration{ - DataDir: dataDir, + DataDir: dataDir, + SketchbookDir: dataDir, + DownloadsDir: dataDir, }, }) if err != nil { @@ -368,11 +370,12 @@ func callBoardsDetails(client rpc.ArduinoCoreClient, instance *rpc.Instance) { } func callBoardAttach(client rpc.ArduinoCoreClient, instance *rpc.Instance) { + currDir, _ := os.Getwd() boardattachresp, err := client.BoardAttach(context.Background(), &rpc.BoardAttachReq{ Instance: instance, BoardUri: "/dev/ttyACM0", - SketchPath: filepath.Join(dataDir, "hello.ino"), + SketchPath: filepath.Join(currDir, "hello.ino"), }) if err != nil { @@ -402,11 +405,12 @@ func callBoardAttach(client rpc.ArduinoCoreClient, instance *rpc.Instance) { } func callCompile(client rpc.ArduinoCoreClient, instance *rpc.Instance) { + currDir, _ := os.Getwd() compRespStream, err := client.Compile(context.Background(), &rpc.CompileReq{ Instance: instance, Fqbn: "arduino:samd:mkr1000", - SketchPath: "hello.ino", + SketchPath: filepath.Join(currDir, "hello.ino"), Verbose: true, }) @@ -440,11 +444,12 @@ func callCompile(client rpc.ArduinoCoreClient, instance *rpc.Instance) { } func callUpload(client rpc.ArduinoCoreClient, instance *rpc.Instance) { + currDir, _ := os.Getwd() uplRespStream, err := client.Upload(context.Background(), &rpc.UploadReq{ Instance: instance, Fqbn: "arduino:samd:mkr1000", - SketchPath: "hello.ino", + SketchPath: filepath.Join(currDir, "hello.ino"), Port: "/dev/ttyACM0", Verbose: true, }) From b78464942a62727be93b53e5dbfe2d24b040535c Mon Sep 17 00:00:00 2001 From: Roberto Sora Date: Wed, 2 Oct 2019 12:35:49 +0200 Subject: [PATCH 2/3] fix help strings --- cli/cli.go | 2 +- cli/daemon/daemon.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 4fb884f9b6b..dfa7161c978 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -80,7 +80,7 @@ func createCliCommandTree(cmd *cobra.Command) { cmd.AddCommand(version.NewCommand()) cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Print the logs on the standard output.") - cmd.PersistentFlags().StringVar(&globals.LogLevel, "log-level", defaultLogLevel, "Messages with this level and above will be logged (default: warn).") + cmd.PersistentFlags().StringVar(&globals.LogLevel, "log-level", defaultLogLevel, "Messages with this level and above will be logged.") cmd.PersistentFlags().StringVar(&logFile, "log-file", "", "Path to the file where logs will be written.") cmd.PersistentFlags().StringVar(&logFormat, "log-format", "text", "The output format for the logs, can be [text|json].") cmd.PersistentFlags().StringVar(&globals.OutputFormat, "format", "text", "The output format, can be [text|json].") diff --git a/cli/daemon/daemon.go b/cli/daemon/daemon.go index 211fc887b72..bfbdeea0f92 100644 --- a/cli/daemon/daemon.go +++ b/cli/daemon/daemon.go @@ -41,7 +41,7 @@ const ( func NewCommand() *cobra.Command { return &cobra.Command{ Use: "daemon", - Short: "Run as a daemon", + Short: fmt.Sprintf("Run as a daemon on port %s", port), Long: "Running as a daemon the initialization of cores and libraries is done only once.", Example: " " + os.Args[0] + " daemon", Args: cobra.NoArgs, From 899c13a0e075930a3079ba72daccd6884a29b274 Mon Sep 17 00:00:00 2001 From: Roberto Sora Date: Thu, 3 Oct 2019 15:16:21 +0200 Subject: [PATCH 3/3] differentiate dataDir folders --- client_example/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client_example/main.go b/client_example/main.go index 3f29dcee3a8..9c1fd91b3a4 100644 --- a/client_example/main.go +++ b/client_example/main.go @@ -168,8 +168,8 @@ func initInstance(client rpc.ArduinoCoreClient) *rpc.Instance { initRespStream, err := client.Init(context.Background(), &rpc.InitReq{ Configuration: &rpc.Configuration{ DataDir: dataDir, - SketchbookDir: dataDir, - DownloadsDir: dataDir, + SketchbookDir: filepath.Join(dataDir, "sketchbook"), + DownloadsDir: filepath.Join(dataDir, "staging"), }, }) if err != nil {