commands

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "development"
	Hash    = "development"
	Date    = "2006-01-02"
)
View Source
var RootCommand = &cobra.Command{
	Use:     "cocainate",
	Short:   "keep screen awake",
	Long:    "keep screen awake",
	Version: Version,
	Args: func(cmd *cobra.Command, args []string) error {
		if pid != 0 && duration == 0 {
			return errors.New("process poling interval must be provided via the -d flag")
		}
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		s := session.New(duration, pid)

		if err := s.Start(); err != nil {
			return err
		}

		if err := s.Wait(); err != nil {
			return err
		}

		if flag.Lookup("test.v") == nil {
			fmt.Print("\r")
		}

		return nil
	},
}

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