gitee.com/mirrors/gauge@v1.0.6/cmd/uninstall.go (about)

     1  // Copyright 2015 ThoughtWorks, Inc.
     2  
     3  // This file is part of Gauge.
     4  
     5  // Gauge is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU General Public License as published by
     7  // the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  
    10  // Gauge 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 General Public License for more details.
    14  
    15  // You should have received a copy of the GNU General Public License
    16  // along with Gauge.  If not, see <http://www.gnu.org/licenses/>.
    17  
    18  package cmd
    19  
    20  import (
    21  	"fmt"
    22  
    23  	"github.com/getgauge/gauge/plugin/install"
    24  	"github.com/spf13/cobra"
    25  )
    26  
    27  var uninstallCmd = &cobra.Command{
    28  	Use:     "uninstall [flags] <plugin>",
    29  	Short:   "Uninstalls a plugin",
    30  	Long:    `Uninstalls a plugin.`,
    31  	Example: `  gauge uninstall java`,
    32  	Run: func(cmd *cobra.Command, args []string) {
    33  		if len(args) < 1 {
    34  			exit(fmt.Errorf("Missing argument <plugin name>."), cmd.UsageString())
    35  		}
    36  		install.UninstallPlugin(args[0], pVersion)
    37  	},
    38  	DisableAutoGenTag: true,
    39  }
    40  
    41  func init() {
    42  	GaugeCmd.AddCommand(uninstallCmd)
    43  	uninstallCmd.Flags().StringVarP(&pVersion, "version", "v", "", "Version of plugin to be uninstalled")
    44  }