Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "version", Aliases: typex.StrOf("v"), Short: "Print the dependency package information", Example: trim(` lug version lug version json lug version t`), Run: func(cmd *cobra.Command, args []string) { defer xerror.RespExit() info, ok := debug.ReadBuildInfo() if !ok { return } var typ string if len(args) > 0 { typ = args[0] } switch typ { case "": dt, err := json.MarshalIndent(version.GetVer(), "", "\t") xerror.Panic(err) fmt.Println(string(dt)) case "json": dt, err := json.MarshalIndent(info, "", "\t") xerror.Panic(err) fmt.Println(string(dt)) case "table", "tb", "t": table := tablewriter.NewWriter(os.Stdout) table.SetHeader([]string{"path", "Version", "Replace"}) table.Append([]string{info.Main.Path, version.Version, replace(info.Main.Replace)}) for _, dep := range info.Deps { table.Append([]string{dep.Path, dep.Version, replace(dep.Replace)}) } table.Render() } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.