github.com/getgauge/gauge@v1.6.9/cmd/uninstall.go (about)

     1  /*----------------------------------------------------------------
     2   *  Copyright (c) ThoughtWorks, Inc.
     3   *  Licensed under the Apache License, Version 2.0
     4   *  See LICENSE in the project root for license information.
     5   *----------------------------------------------------------------*/
     6  
     7  package cmd
     8  
     9  import (
    10  	"fmt"
    11  
    12  	"github.com/getgauge/gauge/plugin/install"
    13  	"github.com/spf13/cobra"
    14  )
    15  
    16  var uninstallCmd = &cobra.Command{
    17  	Use:     "uninstall [flags] <plugin>",
    18  	Short:   "Uninstalls a plugin",
    19  	Long:    `Uninstalls a plugin.`,
    20  	Example: `  gauge uninstall java`,
    21  	Run: func(cmd *cobra.Command, args []string) {
    22  		if len(args) < 1 {
    23  			exit(fmt.Errorf("Missing argument <plugin name>."), cmd.UsageString())
    24  		}
    25  		install.UninstallPlugin(args[0], pVersion)
    26  	},
    27  	DisableAutoGenTag: true,
    28  }
    29  
    30  func init() {
    31  	GaugeCmd.AddCommand(uninstallCmd)
    32  	uninstallCmd.Flags().StringVarP(&pVersion, "version", "v", "", "Version of plugin to be uninstalled")
    33  }