2023-02-28 06:12:00 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2023-02-28 07:04:05 +00:00
|
|
|
var (
|
|
|
|
from string
|
|
|
|
to string
|
|
|
|
rootCmd = &cobra.Command{
|
2023-02-28 07:37:21 +00:00
|
|
|
Use: "converter",
|
|
|
|
Short: "converts your value from and to your given units",
|
|
|
|
Long: `will search for units matching from and to and convert your value accordingly`,
|
2023-02-28 07:04:05 +00:00
|
|
|
}
|
|
|
|
)
|
2023-02-28 06:12:00 +00:00
|
|
|
|
|
|
|
func Execute() {
|
|
|
|
err := rootCmd.Execute()
|
|
|
|
if err != nil {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
2023-02-28 07:13:56 +00:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.InitDefaultHelpFlag()
|
|
|
|
rootCmd.Flags().MarkHidden("help")
|
|
|
|
}
|