Documentation ¶
Index ¶
Constants ¶
View Source
const Header = `#!/bin/sh`
View Source
const Tails = `` /* 421-byte string literal not displayed */
Variables ¶
View Source
var AddCmd = &cobra.Command{ Use: "add", Aliases: []string{"a"}, Short: "Add alternative java version", Long: `Add alternative java version`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { AskAndAdd() } }, }
View Source
var GenShCmd = &cobra.Command{ Use: "gen_sh", Aliases: []string{"gen"}, Short: "Generate shell script", Long: `Generate shell script`, Run: func(cmd *cobra.Command, args []string) { var keys []define.Java row := JavaVersionDB.Find(&keys).RowsAffected if row == 0 { log.Error("Affect Rows is 0") return } log.Info("You have Java version: ") for _, v := range keys { log.Infof("- %v: %v @ %v", v.Version, v.DetailVersion, v.JavaHome) } log.Info("Generate shell script") shellFileContent := GenShCmds(keys) err := os.WriteFile(misc.Configlocate(), []byte(shellFileContent), 0644) if err != nil { log.Error(err) } log.Info("Generate shell script success") log.Info("ShellScript location at ", misc.Configlocate()) log.Info("Please run following command to enable in your shell") log.Infof("echo 'source %v' >> ~/.zshrc", misc.Configlocate()) log.Infof("echo 'source %v' >> ~/.bashrc", misc.Configlocate()) log.Infof("switching your Java Version With command") log.Infof("use_java_<version>") log.Infof("example: use_java_8") }, }
View Source
var JavaVersionDB *gorm.DB
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.