commands

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateService = cli.Command{
	Name:  "create",
	Usage: "creates the service on the OS",
	Flags: flags,
	Action: func(c *cli.Context) error {
		var resolv = c.String("file")
		var domain = c.String("domain")
		if domain == "" {
			return cli.NewExitError("missing domain name", 1)
		}
		return service.Create(resolv, domain)
	},
}

CreateService creates the service on the OS

View Source
var DeleteService = cli.Command{
	Name:  "delete",
	Usage: "stops and delete the service",
	Action: func(c *cli.Context) error {
		_ = service.Stop()
		return service.Delete()
	},
}

DeleteService stops and delete the service

View Source
var RestartService = cli.Command{
	Name:  "restart",
	Usage: "restarts the service",
	Action: func(c *cli.Context) error {
		if err := service.Stop(); err != nil {
			return err
		}
		return service.Start()
	},
}

RestartService stops and starts the service

View Source
var StartService = cli.Command{
	Name:  "start",
	Usage: "starts the service on the OS",
	Action: func(c *cli.Context) error {
		return service.Start()
	},
}

StartService starts the service on the OS

View Source
var StopService = cli.Command{
	Name:  "stop",
	Usage: "stops the service on the OS",
	Action: func(c *cli.Context) error {
		return service.Stop()
	},
}

StopService stops the service on the OS

View Source
var Watch = cli.Command{
	Name:  "watch",
	Usage: "Watch for domain changes",
	Flags: flags,
	Action: func(c *cli.Context) error {
		var events = make(chan bool)
		var domain = c.String("domain")
		var resolv = c.String("file")
		if domain == "" {
			return cli.NewExitError("missing domain name", 1)
		}
		log.Println("Watching", resolv, "for domain", domain)
		go func() {
			if err := amiworking.Watch(resolv, domain, events); err != nil {
				log.Fatal(err)
			}
		}()
		for {
			if <-events {
				log.Println("Working")
			} else {
				log.Println("Not working")
			}
		}
	},
}

Watch action of the app

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