watch

package
v0.81.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "watch",
	Short:   "Watch Util",
	Aliases: []string{"w"},
	Run: func(c *cobra.Command, args []string) {
		i := 0
		for {
			strArgs := strings.Join(args, " ")
			if FlagVerbose {
				fmt.Printf("%d: %s\n", i, strArgs)
			}
			cmd := exec.Command("/bin/sh", "-c", strArgs)
			cmd.Stdin = os.Stdin
			cmd.Stdout = os.Stdout
			cmd.Stderr = os.Stderr
			err := cmd.Run()
			if err != nil {
				if FlagVerbose {
					log.Println(err)
				}
			}
			time.Sleep(time.Duration(FlagSleepTime) * time.Millisecond)
			i++
		}
	},
}
View Source
var FlagSleepTime int
View Source
var FlagVerbose bool

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