From 0c0cba6fb5c47891d8b3c8a65de36bd0ef9433f6 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Tue, 22 Aug 2023 22:27:11 +0000 Subject: [PATCH] jpictl: introduce `env` command Signed-off-by: Alejandro Mery --- cmd/jpictl/env.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cmd/jpictl/env.go diff --git a/cmd/jpictl/env.go b/cmd/jpictl/env.go new file mode 100644 index 0000000..52471c7 --- /dev/null +++ b/cmd/jpictl/env.go @@ -0,0 +1,27 @@ +package main + +import ( + "os" + + "github.com/spf13/cobra" + + "git.jpi.io/amery/jpictl/pkg/zones" +) + +// Command +var envCmd = &cobra.Command{ + Use: "env", + Short: "generates environment variables for shell scripts", + RunE: func(_ *cobra.Command, _ []string) error { + m, err := zones.New(cfg.Base, cfg.Domain) + if err != nil { + return err + } + + return m.WriteEnv(os.Stdout) + }, +} + +func init() { + rootCmd.AddCommand(envCmd) +}