Documentation
¶
Index ¶
Constants ¶
View Source
const (
GroupID string = "vmr"
)
Variables ¶
View Source
var IsSessionMode = &cobra.Command{ Use: "is-session-mode", Aliases: []string{"ism"}, GroupID: GroupID, Short: "Show if current shell is in session mode.", Long: "Example: vmr ism.", Run: func(cmd *cobra.Command, args []string) { if gconv.Bool(os.Getenv(sh.VMDisableEnvName)) { fmt.Println(gprint.BrownStr("Current shell is in session mode.")) if runtime.GOOS != gutils.Windows { fmt.Println(gprint.YellowStr("Nested sessions are not recommeded for vmr. You can use 'exit' to exit session mode.")) fmt.Println(gprint.YellowStr("If you install an SDK in global mode under a session mode shell, the 'source' command will not work, you should use the customed command 'svmr' instead.")) } } else { fmt.Println(gprint.CyanStr("Current shell is in global mode.")) } }, }
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 SetupAutoCompletions = &cobra.Command{ Use: "add-completions", Aliases: []string{"ac"}, GroupID: GroupID, Short: "Add auto-completions for vmr to current shell profile.", Long: "Example: vmr ac.", Run: func(cmd *cobra.Command, args []string) { completions.AddCompletionScriptToShellProfile() }, }
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 ShowInstalledSDKInfo = &cobra.Command{ Use: "installed-info", Aliases: []string{"ii"}, GroupID: GroupID, Short: "Shows installed SDK information.", Long: "Example: vmr ii.", Run: func(cmd *cobra.Command, args []string) { l := cliui.NewSDKSearcher() installedSDKList := l.GetInstalledSDKList() for _, sdkName := range installedSDKList { ll := cliui.NewLocalInstalled() ll.Search(sdkName) versionListString := gprint.YellowStr("%s", sdkName) + ": " + gprint.CyanStr("%s", strings.Join(ll.VersionList, ", ")) fmt.Println(versionListString) } }, }
View Source
var ShowInstalledSDKs = &cobra.Command{ Use: "installed-sdks", Aliases: []string{"in"}, GroupID: GroupID, Short: "Shows installed SDKs.", Long: "Example: vmr in.", Run: func(cmd *cobra.Command, args []string) { l := cliui.NewSDKSearcher() l.PrintInstalledSDKs() }, }
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 ToggleAllowNestedSessions = &cobra.Command{ Use: "nested-sessions", Aliases: []string{"ns"}, GroupID: GroupID, Short: "Toggle nested sessions.", Long: "Example: vmr ns.", Run: func(cmd *cobra.Command, args []string) { if ok := cnf.DefaultConfig.ToggleAllowNestedSessions(); ok { fmt.Println(gprint.CyanStr("Nested sessions are now allowed.")) } else { fmt.Println(gprint.YellowStr("Nested sessions are now disallowed.")) } }, }
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.
Click to show internal directories.
Click to hide internal directories.