version

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "version",
	Short: "current version",
	Long:  `Show current version. Use inspect to get all available version`,
	Run: func(cmd *cobra.Command, args []string) {
		t := terminal.NewTerminalPrint()
		inspect, err := cmd.Flags().GetBool("inspect")
		if err != nil {
			t.PrintErrorOneLineWithExit(err)
		}
		currentVersion := pkg.GetCurrentVersion()
		if len(args) == 0 && !inspect {
			if currentVersion != "" {
				t.PrintInfoOneLine("Current Version: %s", currentVersion)
				t.LineEnd()
			} else {
				t.PrintWarnOneLine("Not Install")
				t.LineEnd()
			}
		} else if inspect {
			releases := release.GetRelease()
			for _, item := range releases {
				if item.Name == currentVersion {
					t.PrintInfoOneLine("%s [%s@%s]", item.Name, item.TagName, item.TargetCommitish)
					t.LineEnd()
				} else {
					fmt.Printf("  %s [%s@%s]\n", item.Name, item.TagName, item.TargetCommitish)
				}
			}
		} else {
			_ = cmd.Help()
		}
	},
}

generateCmd represents the generate command

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