exec

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecCmd = &cobra.Command{
	Use:   "exec",
	Short: "like ecs execute-command",
	Run: func(cmd *cobra.Command, args []string) {
		command, err := cmd.Flags().GetString("command")
		if err != nil {
			log.Fatalln(err)
		}

		wait, err := cmd.Flags().GetInt("wait")
		if err != nil {
			log.Fatalln(err)
		}

		inputFile, err := cmd.Flags().GetString("input-file")
		if err != nil {
			log.Fatalln(err)
		}

		var input inputfile.ExecInputFile

		if inputFile != "" {
			file, err := os.Open(inputFile)
			if err != nil {
				log.Fatalln("Error opening file:", err)
			}
			defer file.Close()

			jsonData, err := io.ReadAll(file)
			if err != nil {
				log.Fatalln("Error reading file:", err)
			}

			err = json.Unmarshal(jsonData, &input)
			if err != nil {
				log.Fatalln("Error decoding JSON:", err)
			}
		}

		err = handler.ExecHandler(command, wait, input.Cluster, input.Service)
		if err != nil {
			log.Fatalln(err)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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