chore: clean up code

This commit is contained in:
2024-01-19 14:12:05 +01:00
parent 3525a90b93
commit aaad8a010c
6 changed files with 46 additions and 34 deletions

View File

@@ -14,7 +14,7 @@ import (
var rootCmd = &cobra.Command{
Use: "mysql-bkup",
Short: "MySQL Backup tool, backup database to S3 or Object Storage",
Long: `MySQL Backup and Restoration tool. Backup database to AWS S3 storage or any S3 Alternatives for Object Storage.`,
Long: `MySQL Database backup and restoration tool. Backup database to AWS S3 storage or any S3 Alternatives for Object Storage.`,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
@@ -50,5 +50,5 @@ func init() {
rootCmd.PersistentFlags().IntP("port", "p", 3306, "Set database port")
rootCmd.PersistentFlags().BoolP("help", "h", false, "Print this help message")
rootCmd.PersistentFlags().BoolP("version", "v", false, "shows version information")
rootCmd.AddCommand(VersionCmd)
}

22
cmd/version.go Normal file
View File

@@ -0,0 +1,22 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"os"
)
var appVersion = os.Getenv("VERSION")
var VersionCmd = &cobra.Command{
Use: "version",
Short: "Show version",
Run: func(cmd *cobra.Command, args []string) {
Version()
},
}
func Version() {
fmt.Printf("Version: %s \n", appVersion)
fmt.Print()
}