subcommands

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Address = &cobra.Command{
	Use:   "address [container_id]",
	Args:  cobra.MinimumNArgs(1),
	Short: "Get ip and port addresses this container exposes",
	Long:  `Get ip and port addresses this container exposes.`,
	Run: func(cmd *cobra.Command, args []string) {
		os.Exit(runner.RunAtom(
			func() error {
				return interactions.ContainerAddresses(args[0])
			},
			time.Duration(Deadline)*time.Second,
		))
	},
}
View Source
var Alive = &cobra.Command{
	Use:   "alive [container_id]",
	Args:  cobra.MinimumNArgs(1),
	Short: "check if a container is up and running",
	Long:  `check if a container is up and running.`,
	Run: func(cmd *cobra.Command, args []string) {
		if Deadline > 1 && isatty.IsTerminal(os.Stdout.Fd()) {
			s := spinner.New(spinner.CharSets[12], 250*time.Millisecond)
			s.Start()
			defer s.Stop()
		}

		os.Exit(runner.RunAtom(
			func() error {
				return interactions.ContainerIsAlive(args[0])
			},
			time.Duration(Deadline)*time.Second,
		))
	},
}
View Source
var Deadline int
View Source
var Find = &cobra.Command{
	Use:   "find [project] [service]",
	Args:  cobra.MinimumNArgs(2),
	Short: "Find a docker-compose project's service instance",
	Long: `Find a docker-compose project's service instance.
	
	If there are multiple instances the first healthy container id will be returned.`,
	Run: func(cmd *cobra.Command, args []string) {
		os.Exit(runner.RunAtom(
			func() error {
				return interactions.FindComposeService(args[0], args[1])
			},
			time.Duration(Deadline)*time.Second,
		))
	},
}
View Source
var Healthy = &cobra.Command{
	Use:   "healthy [container_id]",
	Args:  cobra.MinimumNArgs(1),
	Short: "check if a container is up and healthy",
	Long:  `check if a container is up and healthy.`,
	Run: func(cmd *cobra.Command, args []string) {
		if Deadline > 1 && isatty.IsTerminal(os.Stdout.Fd()) {
			s := spinner.New(spinner.CharSets[12], 250*time.Millisecond)
			s.Start()
			defer s.Stop()
		}

		os.Exit(runner.RunAtom(
			func() error {
				return interactions.ContainerIsHealthy(args[0])
			},
			time.Duration(Deadline)*time.Second,
		))
	},
}

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