From ca12012312351aa2555a6634aef7076ad2cdcb49 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 11 Jul 2019 18:24:56 +0200 Subject: [PATCH] remove emptyness test, it depends on the state of the machine running the tests --- cli/cli_test.go | 20 -------------------- cli/serial/serial.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 cli/serial/serial.go diff --git a/cli/cli_test.go b/cli/cli_test.go index fd638cb719c..50efa732953 100644 --- a/cli/cli_test.go +++ b/cli/cli_test.go @@ -25,7 +25,6 @@ import ( "os" "os/exec" "path/filepath" - "strings" "testing" "bou.ke/monkey" @@ -544,10 +543,6 @@ board_manager: err = ioutil.WriteFile(filepath.Join(currDataDir, "library_index.json"), []byte(`{ "libraries": [] }`), os.FileMode(0644)) require.NoError(t, err, "Writing empty json index file") - // Empty cores list - exitCode, _ := executeWithArgs("--config-file", configFile, "core", "list") - require.Zero(t, exitCode) - // Dump config with cmd-line specific file exitCode, d := executeWithArgs("--config-file", configFile, "config", "dump") require.Zero(t, exitCode) @@ -556,11 +551,6 @@ board_manager: // Update inexistent index exitCode, _ = executeWithArgs("--config-file", configFile, "core", "update-index") require.NotZero(t, exitCode) - - // Empty cores list - exitCode, d = executeWithArgs("--config-file", configFile, "core", "list") - require.Zero(t, exitCode) - require.Empty(t, strings.TrimSpace(string(d))) } func TestCoreCommandsIntegration(t *testing.T) { @@ -601,11 +591,6 @@ func TestCoreCommandsIntegration(t *testing.T) { require.NotZero(t, exitCode) require.Contains(t, string(d), "invalid item") - // Empty cores list - exitCode, d = executeWithArgs("core", "list") - require.Zero(t, exitCode) - require.Empty(t, strings.TrimSpace(string(d))) - // Install avr 1.6.16 exitCode, d = executeWithArgs("core", "install", "arduino:avr@1.6.16") require.Zero(t, exitCode) @@ -671,9 +656,4 @@ func TestCoreCommandsIntegration(t *testing.T) { exitCode, d = executeWithArgs("core", "uninstall", "arduino:avr") require.Zero(t, exitCode) require.Contains(t, string(d), AVR+" uninstalled") - - // Empty cores list - exitCode, d = executeWithArgs("core", "list") - require.Zero(t, exitCode) - require.Empty(t, strings.TrimSpace(string(d))) } diff --git a/cli/serial/serial.go b/cli/serial/serial.go new file mode 100644 index 00000000000..1b491adb1c2 --- /dev/null +++ b/cli/serial/serial.go @@ -0,0 +1,34 @@ +// This file is part of arduino-cli. +// +// Copyright 2019 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to modify or +// otherwise use the software for commercial activities involving the Arduino +// software without disclosing the source code of your own applications. To purchase +// a commercial license, send an email to license@arduino.cc. + +package serial + +import ( + "os" + + "github.com/spf13/cobra" +) + +// InitCommand prepares the command. +func InitCommand() *cobra.Command { + serialCommand := &cobra.Command{ + Use: "serial", + Short: "Arduino CLI Serial Commands.", + Long: "Arduino CLI Serial Commands.", + Example: " " + os.Args[0] + " serial monitor /dev/tty0", + } + + return serialCommand +}