vcli

package
v0.6.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupID string = "vmr"
)

Variables

View Source
var SearchVersionsCmd = &cobra.Command{
	Use:     "search",
	Aliases: []string{"s"},
	GroupID: GroupID,
	Short:   "Searches available versions.",
	Long:    "Example: vmr search <sdk-name>.",
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			cmd.Help()
			return
		}
		sdkName := args[0]
		l := cliui.NewVersionSearcher()
		if ok, _ := cmd.Flags().GetBool("search-by-conda"); ok {
			l.EnableCondaSearch()
		}
		l.Search(sdkName, "")
	},
}

search versions for an SDK

View Source
var ShowInstalledCmd = &cobra.Command{
	Use:     "local",
	Aliases: []string{"l"},
	GroupID: GroupID,
	Short:   "Shows installed versions for an SDK.",
	Long:    "Example: vmr local <sdk name>.",
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			cmd.Help()
			return
		}
		sdkName := args[0]
		l := cliui.NewLocalInstalled()
		l.Search(sdkName)
		l.Show()
	},
}

Show installed versions for an SDK.

View Source
var ShowSDKCmd = &cobra.Command{
	Use:     "show",
	Aliases: []string{"S"},
	GroupID: GroupID,
	Short:   "Show available SDKs.",
	Long:    "Show the SDKs supported by VMR.",
	Run: func(cmd *cobra.Command, args []string) {
		l := cliui.NewSDKSearcher()
		l.Show()
	},
}

show SDK list

View Source
var UninstallVersionCmd = &cobra.Command{
	Use:     "uninstall",
	Aliases: []string{"uni", "r"},
	GroupID: GroupID,
	Short:   "Uninstall versions for an SDK.",
	Long:    "Example: vmr uninstall sdkname@version or sdkname@all.",
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			cmd.Help()
			return
		}
		versionInfo := args[0]
		if !strings.Contains(versionInfo, "@") {
			cmd.Help()
			return
		}
		sList := strings.Split(versionInfo, "@")
		if len(sList) != 2 || sList[1] == "" {
			cmd.Help()
			return
		}
		sdkName := sList[0]
		version := sList[1]

		if version == "all" {
			lif := installer.NewIVFinder(sdkName)
			lif.UninstallAllVersions()
		} else {
			versionFilePath := download.GetVersionFilePath(sdkName)
			content, _ := os.ReadFile(versionFilePath)
			rawVersionList := make(download.VersionList)
			json.Unmarshal(content, &rawVersionList)
			installerType := "unarchiver"
			for _, vl := range rawVersionList {
				if len(vl) > 0 {
					installerType = vl[0].Installer
					break
				}
			}
			ins := installer.NewInstaller(sdkName, version, "", download.Item{Installer: installerType})
			ins.Uninstall()
		}
	},
}

Uninstalls a version for an SDK.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL