Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "random-verbose", Short: "Sleep random time with verbose output", Args: cobra.NoArgs, Run: func(c *cobra.Command, args []string) { rand.Seed(time.Now().UnixNano()) sleepTimeInSeconds := rand.Intn(FlagMaxTime-FlagMinTime) + FlagMinTime fmt.Printf("Sleep %d seconds\n", sleepTimeInSeconds) for i := 0; i < sleepTimeInSeconds; i++ { time.Sleep(time.Second) fmt.Printf("... %d/%d seconds\n", i, sleepTimeInSeconds) } fmt.Println("Done.") }, }
View Source
var FlagMaxTime int
View Source
var FlagMinTime int
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.