Commit c316b386 authored by Umberto Baldi's avatar Umberto Baldi

added info logging in every command for consistency

parent e642f729
......@@ -27,6 +27,7 @@ import (
"github.com/arduino/arduino-cli/cli/output"
"github.com/arduino/arduino-cli/commands/board"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -51,6 +52,8 @@ func initAttachCommand() *cobra.Command {
func runAttachCommand(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli board attach`")
path := ""
if len(args) > 1 {
path = args[1]
......
......@@ -28,6 +28,7 @@ import (
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/arduino-cli/table"
"github.com/fatih/color"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -58,6 +59,8 @@ func initDetailsCommand() *cobra.Command {
func runDetailsCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli board details`")
// remove once `board details <fqbn>` is removed
if fqbn.String() == "" && len(args) > 0 {
fqbn.Set(args[0])
......
......@@ -28,6 +28,7 @@ import (
"github.com/arduino/arduino-cli/commands/board"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/arduino-cli/table"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -57,6 +58,9 @@ func initListCommand() *cobra.Command {
// runListCommand detects and lists the connected arduino boards
func runListCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli board list`")
if watch {
watchList(cmd, inst)
os.Exit(0)
......
......@@ -27,6 +27,7 @@ import (
"github.com/arduino/arduino-cli/commands/board"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/arduino-cli/table"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -52,6 +53,8 @@ for a specific board if you specify the board name`),
func runListAllCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli board listall`")
list, err := board.ListAll(context.Background(), &rpc.BoardListAllRequest{
Instance: inst,
SearchArgs: args,
......
......@@ -28,6 +28,7 @@ import (
"github.com/arduino/arduino-cli/commands/board"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/arduino-cli/table"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -50,6 +51,8 @@ for a specific board if you specify the board name`),
func runSearchCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli board search`")
res, err := board.Search(context.Background(), &rpc.BoardSearchRequest{
Instance: inst,
SearchArgs: strings.Join(args, " "),
......
......@@ -26,6 +26,7 @@ import (
"github.com/arduino/arduino-cli/commands/upload"
"github.com/arduino/arduino-cli/i18n"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -64,6 +65,8 @@ func NewCommand() *cobra.Command {
func runBootloaderCommand(command *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli burn-bootloader`")
// We don't need a Sketch to upload a board's bootloader
discoveryPort, err := port.GetPort(instance, nil)
if err != nil {
......
......@@ -38,7 +38,7 @@ func initCleanCommand() *cobra.Command {
}
func runCleanCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino cache clean`")
logrus.Info("Executing `arduino-cli cache clean`")
cachePath := configuration.Settings.GetString("directories.Downloads")
err := os.RemoveAll(cachePath)
......
......@@ -26,6 +26,7 @@ import (
"github.com/arduino/arduino-cli/cli/output"
"github.com/arduino/arduino-cli/configuration"
"github.com/arduino/arduino-cli/i18n"
"github.com/sirupsen/logrus"
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/instance"
......@@ -123,6 +124,8 @@ func NewCommand() *cobra.Command {
func runCompileCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli compile`")
path := ""
if len(args) > 0 {
path = args[0]
......
......@@ -21,6 +21,7 @@ import (
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cli/i18n"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -47,6 +48,7 @@ func NewCommand() *cobra.Command {
}
func runCompletionCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli completion`")
if completionNoDesc && (args[0] == "powershell") {
feedback.Errorf(tr("Error: command description is not supported by %v"), args[0])
os.Exit(errorcodes.ErrGeneric)
......
......@@ -22,6 +22,7 @@ import (
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cli/configuration"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -43,6 +44,7 @@ func initAddCommand() *cobra.Command {
}
func runAddCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli config add`")
key := args[0]
kind := validateKey(key)
......
......@@ -22,6 +22,7 @@ import (
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cli/configuration"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
......@@ -44,6 +45,7 @@ func initDeleteCommand() *cobra.Command {
}
func runDeleteCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli config delete`")
toDelete := args[0]
keys := []string{}
......
......@@ -38,7 +38,7 @@ func initDumpCommand() *cobra.Command {
}
func runDumpCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino config dump`")
logrus.Info("Executing `arduino-cli config dump`")
feedback.PrintResult(dumpResult{configuration.Settings.AllSettings()})
}
......
......@@ -59,6 +59,7 @@ func initInitCommand() *cobra.Command {
}
func runInitCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli config init`")
var configFileAbsPath *paths.Path
var absPath *paths.Path
......
......@@ -22,6 +22,7 @@ import (
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cli/configuration"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -43,6 +44,7 @@ func initRemoveCommand() *cobra.Command {
}
func runRemoveCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli config remove`")
key := args[0]
kind := validateKey(key)
......
......@@ -23,6 +23,7 @@ import (
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cli/configuration"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -46,6 +47,7 @@ func initSetCommand() *cobra.Command {
}
func runSetCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli config set`")
key := args[0]
kind := validateKey(key)
......
......@@ -51,7 +51,7 @@ func initDownloadCommand() *cobra.Command {
func runDownloadCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino core download`")
logrus.Info("Executing `arduino-cli core download`")
platformsRefs, err := arguments.ParseReferences(args, true)
if err != nil {
......
......@@ -59,7 +59,7 @@ func initInstallCommand() *cobra.Command {
func runInstallCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino core install`")
logrus.Info("Executing `arduino-cli core install`")
platformsRefs, err := arguments.ParseReferences(args, true)
if err != nil {
......
......@@ -50,7 +50,7 @@ func initListCommand() *cobra.Command {
func runListCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino core list`")
logrus.Info("Executing `arduino-cli core list`")
platforms, err := core.GetPlatforms(&rpc.PlatformListRequest{
Instance: inst,
......
......@@ -82,7 +82,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
}
arguments := strings.ToLower(strings.Join(args, " "))
logrus.Infof("Executing `arduino core search` with args: '%s'", arguments)
logrus.Infof("Executing `arduino-cli core search` with args: '%s'", arguments)
resp, err := core.PlatformSearch(&rpc.PlatformSearchRequest{
Instance: inst,
......
......@@ -48,7 +48,7 @@ func initUninstallCommand() *cobra.Command {
func runUninstallCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino core uninstall`")
logrus.Info("Executing `arduino-cli core uninstall`")
platformsRefs, err := arguments.ParseReferences(args, true)
if err != nil {
......
......@@ -42,8 +42,8 @@ func initUpdateIndexCommand() *cobra.Command {
}
func runUpdateIndexCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino core update-index`")
inst := instance.CreateInstanceAndRunFirstUpdate()
logrus.Info("Executing `arduino-cli core update-index`")
_, err := commands.UpdateIndex(context.Background(), &rpc.UpdateIndexRequest{
Instance: inst,
......
......@@ -51,7 +51,7 @@ func initUpgradeCommand() *cobra.Command {
func runUpgradeCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino core upgrade`")
logrus.Info("Executing `arduino-cli core upgrade`")
// if no platform was passed, upgrade allthethings
if len(args) == 0 {
......
......@@ -67,6 +67,7 @@ func NewCommand() *cobra.Command {
}
func runDaemonCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli daemon`")
if configuration.Settings.GetBool("metrics.enabled") {
metrics.Activate("daemon")
......
......@@ -31,6 +31,7 @@ import (
"github.com/arduino/arduino-cli/table"
"github.com/arduino/go-properties-orderedmap"
"github.com/fatih/color"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -67,6 +68,7 @@ func NewCommand() *cobra.Command {
func runDebugCommand(command *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli debug`")
path := ""
if len(args) > 0 {
......
......@@ -58,6 +58,7 @@ func NewCommand() *cobra.Command {
}
func generateBashCompletions(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli generate-docs`")
if outputDir == "" {
outputDir = "docs/bash_completions"
}
......
......@@ -27,6 +27,7 @@ import (
"github.com/arduino/arduino-cli/commands/lib"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/fatih/color"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -49,6 +50,7 @@ func initDepsCommand() *cobra.Command {
func runDepsCommand(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli lib deps`")
libRef, err := ParseLibraryReferenceArgAndAdjustCase(instance, args[0])
if err != nil {
feedback.Errorf(tr("Arguments error: %v"), err)
......
......@@ -27,6 +27,7 @@ import (
"github.com/arduino/arduino-cli/cli/output"
"github.com/arduino/arduino-cli/commands/lib"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -49,6 +50,7 @@ func initDownloadCommand() *cobra.Command {
func runDownloadCommand(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli lib download`")
refs, err := ParseLibraryReferenceArgsAndAdjustCase(instance, args)
if err != nil {
feedback.Errorf(tr("Invalid argument passed: %v"), err)
......
......@@ -56,7 +56,7 @@ func initExamplesCommand() *cobra.Command {
func runExamplesCommand(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Show examples for library")
logrus.Info("Executing `arduino-cli lib examples`")
name := ""
if len(args) > 0 {
......
......@@ -31,6 +31,7 @@ import (
"github.com/arduino/arduino-cli/configuration"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/go-paths-helper"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
semver "go.bug.st/relaxed-semver"
)
......@@ -65,6 +66,7 @@ func initInstallCommand() *cobra.Command {
func runInstallCommand(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli lib install`")
if zipPath || gitURL {
if !configuration.Settings.GetBool("library.enable_unsafe_install") {
......
......@@ -58,7 +58,7 @@ not listed, they can be listed by adding the --all flag.`),
func runListCommand(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Listing")
logrus.Info("Executing `arduino-cli lib list`")
name := ""
if len(args) > 0 {
......
......@@ -53,6 +53,8 @@ func initSearchCommand() *cobra.Command {
func runSearchCommand(cmd *cobra.Command, args []string) {
inst, status := instance.Create()
logrus.Info("Executing `arduino-cli lib search`")
if status != nil {
feedback.Errorf(tr("Error creating instance: %v"), status)
os.Exit(errorcodes.ErrGeneric)
......@@ -71,7 +73,6 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
feedback.Errorf(tr("Error initializing instance: %v"), err)
}
logrus.Info("Executing `arduino lib search`")
searchResp, err := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{
Instance: inst,
Query: (strings.Join(args, " ")),
......
......@@ -47,9 +47,9 @@ func initUninstallCommand() *cobra.Command {
}
func runUninstallCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino lib uninstall`")
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli lib uninstall`")
refs, err := ParseLibraryReferenceArgsAndAdjustCase(instance, args)
if err != nil {
feedback.Errorf(tr("Invalid argument passed: %v"), err)
......
......@@ -42,8 +42,8 @@ func initUpdateIndexCommand() *cobra.Command {
}
func runUpdateIndexCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino lib update-index`")
inst := instance.CreateInstanceAndRunFirstUpdate()
logrus.Info("Executing `arduino-cli lib update-index`")
err := commands.UpdateLibrariesIndex(context.Background(), &rpc.UpdateLibrariesIndexRequest{
Instance: inst,
......
......@@ -43,6 +43,7 @@ func initUpgradeCommand() *cobra.Command {
func runUpgradeCommand(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli lib upgrade`")
if len(args) == 0 {
err := lib.LibraryUpgradeAll(instance.Id, output.ProgressBar(), output.TaskProgress())
......
......@@ -34,6 +34,7 @@ import (
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/arduino-cli/table"
"github.com/fatih/color"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -68,6 +69,7 @@ func NewCommand() *cobra.Command {
func runMonitorCmd(cmd *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli monitor`")
if !configuration.HasConsole {
quiet = true
......
......@@ -48,7 +48,7 @@ that can be upgraded. If nothing needs to be updated the output is empty.`),
func runOutdatedCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino outdated`")
logrus.Info("Executing `arduino-cli outdated`")
outdatedResp, err := commands.Outdated(context.Background(), &rpc.OutdatedRequest{
Instance: inst,
......
......@@ -54,7 +54,7 @@ func initArchiveCommand() *cobra.Command {
}
func runArchiveCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino sketch archive`")
logrus.Info("Executing `arduino-cli sketch archive`")
sketchPath := paths.New(".")
if len(args) >= 1 {
......
......@@ -26,6 +26,7 @@ import (
sk "github.com/arduino/arduino-cli/commands/sketch"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
paths "github.com/arduino/go-paths-helper"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -42,6 +43,7 @@ func initNewCommand() *cobra.Command {
}
func runNewCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli sketch new`")
// Trim to avoid issues if user creates a sketch adding the .ino extesion to the name
sketchName := args[0]
trimmedSketchName := strings.TrimSuffix(sketchName, globals.MainFileValidExtension)
......
......@@ -52,8 +52,8 @@ var updateFlags struct {
}
func runUpdateCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino update`")
inst := instance.CreateInstanceAndRunFirstUpdate()
logrus.Info("Executing `arduino-cli update`")
err := commands.UpdateCoreLibrariesIndex(context.Background(), &rpc.UpdateCoreLibrariesIndexRequest{
Instance: inst,
......
......@@ -52,7 +52,7 @@ func NewCommand() *cobra.Command {
func runUpgradeCommand(cmd *cobra.Command, args []string) {
inst := instance.CreateAndInit()
logrus.Info("Executing `arduino upgrade`")
logrus.Info("Executing `arduino-cli upgrade`")
err := commands.Upgrade(context.Background(), &rpc.UpgradeRequest{
Instance: inst,
......
......@@ -26,6 +26,7 @@ import (
"github.com/arduino/arduino-cli/commands/upload"
"github.com/arduino/arduino-cli/i18n"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
......@@ -69,6 +70,7 @@ func NewCommand() *cobra.Command {
func runUploadCommand(command *cobra.Command, args []string) {
instance := instance.CreateAndInit()
logrus.Info("Executing `arduino-cli upload`")
path := ""
if len(args) > 0 {
......
......@@ -24,6 +24,7 @@ import (
"github.com/arduino/arduino-cli/cli/globals"
"github.com/arduino/arduino-cli/cli/updater"
"github.com/arduino/arduino-cli/i18n"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
semver "go.bug.st/relaxed-semver"
)
......@@ -44,6 +45,7 @@ func NewCommand() *cobra.Command {
}
func runVersionCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino-cli version`")
if strings.Contains(globals.VersionInfo.VersionString, "git-snapshot") || strings.Contains(globals.VersionInfo.VersionString, "nightly") {
// We're using a development version, no need to check if there's a
// new release available
......
......@@ -31,7 +31,7 @@ var tr = i18n.Tr
// LibraryDownload FIXMEDOC
func LibraryDownload(ctx context.Context, req *rpc.LibraryDownloadRequest, downloadCB commands.DownloadProgressCB) (*rpc.LibraryDownloadResponse, error) {
logrus.Info("Executing `arduino lib download`")
logrus.Info("Executing `arduino-cli lib download`")
lm := commands.GetLibraryManager(req.GetInstance().GetId())
if lm == 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