@@ -2,16 +2,11 @@ package cmd
22
33import (
44 "fmt"
5- "os"
6- "os/exec"
7- "strings"
8- "time"
95
106 "github.com/gookit/color"
117 log "github.com/sirupsen/logrus"
128 "github.com/spf13/cobra"
139
14- "github.com/gitpod-io/leeway/pkg/graphview"
1510 "github.com/gitpod-io/leeway/pkg/leeway"
1611)
1712
@@ -46,8 +41,6 @@ var describeDependenciesCmd = &cobra.Command{
4641
4742 if dot , _ := cmd .Flags ().GetBool ("dot" ); dot {
4843 return printDepGraphAsDot (pkgs )
49- } else if serve , _ := cmd .Flags ().GetString ("serve" ); serve != "" {
50- serveDepGraph (serve , pkgs )
5144 } else {
5245 for _ , pkg := range pkgs {
5346 printDepTree (pkg , 0 )
@@ -122,30 +115,8 @@ func printDepGraphAsDot(pkgs []*leeway.Package) error {
122115 return nil
123116}
124117
125- func serveDepGraph (addr string , pkgs []* leeway.Package ) {
126- go func () {
127- browser := os .Getenv ("BROWSER" )
128- if browser == "" {
129- return
130- }
131-
132- time .Sleep (2 * time .Second )
133- taddr := addr
134- if strings .HasPrefix (taddr , ":" ) {
135- taddr = fmt .Sprintf ("localhost%s" , addr )
136- }
137- taddr = fmt .Sprintf ("http://%s" , taddr )
138- //nolint:errcheck
139- exec .Command (browser , taddr ).Start ()
140- }()
141-
142- log .Infof ("serving dependency graph on %s" , addr )
143- log .Fatal (graphview .Serve (addr , pkgs ... ))
144- }
145-
146118func init () {
147119 describeCmd .AddCommand (describeDependenciesCmd )
148120
149121 describeDependenciesCmd .Flags ().Bool ("dot" , false , "produce Graphviz dot output" )
150- describeDependenciesCmd .Flags ().String ("serve" , "" , "serve the interactive dependency graph on this address" )
151122}
0 commit comments