cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Enter = &cobra.Command{
		Use:     "enter",
		Aliases: []string{"shell"},
		Short:   "Launches a shell inside the container",
		Long: `Launches a the shell defined in the config inside the container.
		
		To install packages inside the container use the develbox`,
		RunE: func(cmd *cobra.Command, args []string) error {
			cfg, err := config.Read()
			if err != nil {
				return err
			}
			pman := podman.New(cfg.Podman.Path)
			pman.Start([]string{cfg.Podman.Container.Name}, podman.Attach{})
			return container.Enter(cfg, root)
		},
	}
)
View Source
var (
	Exec = &cobra.Command{
		Use:                "exec",
		Short:              "Executes a program inside the container",
		DisableFlagParsing: true,
		RunE: func(cmd *cobra.Command, args []string) error {
			cfg, err := config.Read()
			if err != nil {
				return err
			}
			pman := podman.New(cfg.Podman.Path)
			pman.Start([]string{cfg.Podman.Container.Name}, podman.Attach{})

			params := []string{cfg.Podman.Container.Name}
			params = append(params, strings.Join(args, " "))
			command := pman.Exec(params, false, false,
				podman.Attach{
					Stdin:     true,
					Stdout:    true,
					Stderr:    true,
					PseudoTTY: true,
				})

			return command.Run()
		},
	}
)
View Source
var (
	Run = &cobra.Command{
		Use:   "run",
		Short: "Runs the command defined in the config file",
		RunE: func(cmd *cobra.Command, args []string) error {
			cfg, err := config.Read()
			if err != nil {
				return err
			}
			pman := podman.New(cfg.Podman.Path)
			pman.Start([]string{cfg.Podman.Container.Name}, podman.Attach{})

			params := []string{cfg.Podman.Container.Name}
			params = append(params, cfg.Commands[args[0]])

			command := pman.Exec(params, true, false,
				podman.Attach{
					Stdin:     true,
					Stdout:    true,
					Stderr:    true,
					PseudoTTY: true,
				})

			return command.Run()
		},
	}
)
View Source
var (
	Version = &cobra.Command{
		Use:   "version",
		Short: "Prints the current version of develbox",
		Long:  `Prints the current version of develbox`,
		Run: func(cmd *cobra.Command, args []string) {
			root := cmd.Root()
			root.Print(root.Version)
		},
	}
)

Prints the current version set on the root command

Functions

func Execute

func Execute()

Types

This section is empty.

Directories

Path Synopsis
Creates a dockerfile based on the config file
Creates a dockerfile based on the config file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL