cmd

package
v0.0.0-...-000270e Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PingCmd = &cobra.Command{
	Use:   "ping",
	Short: "Ping the server",
	Long:  "Ping the server",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("ping called")

		if len(args) < 1 {
			log.Fatal("usage: ping host [timeout]")
		}
		host = args[0]
		if len(host) < 1 {
			log.Fatal("No host provided")
		}
		err := error(nil)
		timeout, err = strconv.Atoi(args[1])
		if err != nil {
			log.Fatal("Invalid timeout")
		}
		if timeout < 1 {
			log.Fatal("Invalid timeout")
		}
		fmt.Println("host:", host)
		if host == "" {
			log.Fatal("No host provided")
		}

		ping()
	},
}

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