|
|
|
@ -4,6 +4,7 @@ import ( |
|
|
|
|
"bufio" |
|
|
|
|
"fmt" |
|
|
|
|
"os" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/spf13/cobra" |
|
|
|
|
|
|
|
|
@ -22,10 +23,19 @@ var rootCommand = &cobra.Command{ |
|
|
|
|
Args: cobra.ExactArgs(1), |
|
|
|
|
Use: "hal", |
|
|
|
|
RunE: runRootCommand, |
|
|
|
|
PreRun: func(cmd *cobra.Command, args []string) { |
|
|
|
|
startTime = time.Now() |
|
|
|
|
}, |
|
|
|
|
PostRun: func(cmd *cobra.Command, args []string) { |
|
|
|
|
totalTime := time.Since(startTime) |
|
|
|
|
fmt.Printf("Total execution time: %v", totalTime) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var debug bool |
|
|
|
|
|
|
|
|
|
var startTime time.Time |
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
|
rootCommand.Flags().BoolVarP(&debug, "debug", "d", false, "Enable debug mode") |
|
|
|
|
} |
|
|
|
|