random_verbose

package
v0.79.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 5 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL