@@ -6,6 +6,7 @@ package boxcli
6
6
import (
7
7
"bytes"
8
8
"encoding/json"
9
+ "fmt"
9
10
"os/exec"
10
11
11
12
"github.com/spf13/cobra"
@@ -31,6 +32,7 @@ func integrateCmd() *cobra.Command {
31
32
},
32
33
}
33
34
command .AddCommand (integrateVSCodeCmd ())
35
+ command .AddCommand (integrateTestCmd ())
34
36
return command
35
37
}
36
38
@@ -49,6 +51,38 @@ func integrateVSCodeCmd() *cobra.Command {
49
51
return command
50
52
}
51
53
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
+
52
86
type parentMessage struct {
53
87
ConfigDir string `json:"configDir"`
54
88
}
0 commit comments