Skip to content

Commit 073e926

Browse files
committed
debugging integrate command
1 parent fbd7fb1 commit 073e926

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

internal/boxcli/integrate.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package boxcli
66
import (
77
"bytes"
88
"encoding/json"
9+
"fmt"
910
"os/exec"
1011

1112
"github.com/spf13/cobra"
@@ -31,6 +32,7 @@ func integrateCmd() *cobra.Command {
3132
},
3233
}
3334
command.AddCommand(integrateVSCodeCmd())
35+
command.AddCommand(integrateTestCmd())
3436
return command
3537
}
3638

@@ -49,6 +51,38 @@ func integrateVSCodeCmd() *cobra.Command {
4951
return command
5052
}
5153

54+
func integrateTestCmd() *cobra.Command {
55+
flags := &integrateCmdFlags{}
56+
command := &cobra.Command{
57+
Use: "test",
58+
Hidden: true,
59+
Short: "for test purposes",
60+
RunE: func(cmd *cobra.Command, args []string) error {
61+
return runIntegrateTestCmd(cmd, flags)
62+
},
63+
}
64+
flags.config.register(command)
65+
66+
return command
67+
}
68+
69+
func runIntegrateTestCmd(cmd *cobra.Command, flags *integrateCmdFlags) error {
70+
box, err := devbox.Open(&devopt.Opts{
71+
Dir: flags.config.path,
72+
Writer: cmd.OutOrStdout(),
73+
})
74+
if err != nil {
75+
return err
76+
}
77+
// Get env variables of a devbox shell
78+
envVars, err := box.PrintEnvVars(cmd.Context())
79+
if err != nil {
80+
return err
81+
}
82+
fmt.Println(envVars)
83+
return nil
84+
}
85+
5286
type parentMessage struct {
5387
ConfigDir string `json:"configDir"`
5488
}

0 commit comments

Comments
 (0)