generated from brevdev/seed
-
Notifications
You must be signed in to change notification settings - Fork 9
/
paths.go
42 lines (36 loc) · 861 Bytes
/
paths.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package paths
import (
"fmt"
"io/ioutil"
"strings"
"github.com/brevdev/brev-cli/pkg/terminal"
"github.com/spf13/cobra"
// breverrors "github.com/brevdev/brev-cli/pkg/errors"
)
func NewCmdApprove(_ *terminal.Terminal) *cobra.Command {
cmd := &cobra.Command{
Annotations: map[string]string{},
Use: "paths",
RunE: func(cmd *cobra.Command, args []string) error {
paths := GetPaths()
fmt.Println(paths)
return nil
},
}
return cmd
}
func GetPaths() string {
vscodePaths := GetVsCodePaths()
return strings.Join(vscodePaths, ":")
}
func GetVsCodePaths() []string {
fi, err := ioutil.ReadDir("/home/brev/.vscode-server/bin")
if err != nil {
return []string{}
}
paths := []string{}
for _, f := range fi {
paths = append(paths, fmt.Sprintf("/home/brev/.vscode-server/bin/%s/bin/remote-cli", f.Name()))
}
return paths
}