30 lines
464 B
Go
30 lines
464 B
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
from string
|
|
to string
|
|
rootCmd = &cobra.Command{
|
|
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`,
|
|
}
|
|
)
|
|
|
|
func Execute() {
|
|
err := rootCmd.Execute()
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.InitDefaultHelpFlag()
|
|
rootCmd.Flags().MarkHidden("help")
|
|
}
|