27 lines
		
	
	
		
			409 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			27 lines
		
	
	
		
			409 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package version
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"fmt"
							 | 
						||
| 
								 | 
							
									"github.com/spf13/cobra"
							 | 
						||
| 
								 | 
							
									"go-admin/common/global"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var (
							 | 
						||
| 
								 | 
							
									StartCmd = &cobra.Command{
							 | 
						||
| 
								 | 
							
										Use:     "version",
							 | 
						||
| 
								 | 
							
										Short:   "Get version info",
							 | 
						||
| 
								 | 
							
										Example: "go-admin version",
							 | 
						||
| 
								 | 
							
										PreRun: func(cmd *cobra.Command, args []string) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										},
							 | 
						||
| 
								 | 
							
										RunE: func(cmd *cobra.Command, args []string) error {
							 | 
						||
| 
								 | 
							
											return run()
							 | 
						||
| 
								 | 
							
										},
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func run() error {
							 | 
						||
| 
								 | 
							
									fmt.Println(global.Version)
							 | 
						||
| 
								 | 
							
									return nil
							 | 
						||
| 
								 | 
							
								}
							 |