github.com/arduino/arduino-cloud-cli@v0.0.0-20240517070944-e7a449561083/cli/version/version.go (about)

     1  // This file is part of arduino-cloud-cli.
     2  //
     3  // Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/)
     4  //
     5  // This program is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU Affero General Public License as published
     7  // by the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  //
    10  // This program is distributed in the hope that it will be useful,
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  // GNU Affero General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU Affero General Public License
    16  // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    17  
    18  package version
    19  
    20  import (
    21  	"os"
    22  
    23  	"github.com/arduino/arduino-cli/cli/feedback"
    24  	v "github.com/arduino/arduino-cloud-cli/version"
    25  	"github.com/spf13/cobra"
    26  )
    27  
    28  // NewCommand creates a new `version` command.
    29  func NewCommand() *cobra.Command {
    30  	return &cobra.Command{
    31  		Use:     "version",
    32  		Short:   "Shows version number of Arduino Cloud CLI.",
    33  		Long:    "Shows the version number of Arduino Cloud CLI which is installed on your system.",
    34  		Example: "  " + os.Args[0] + " version",
    35  		Args:    cobra.NoArgs,
    36  		Run:     run,
    37  	}
    38  }
    39  
    40  func run(cmd *cobra.Command, args []string) {
    41  	feedback.Print(v.VersionInfo)
    42  }