Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) open browser automatically for explore sub command #592

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/explore.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/overmindtech/pterm"
"github.com/overmindtech/sdp-go"
stdlibsource "github.com/overmindtech/stdlib-source/sources"
"github.com/pkg/browser"
log "github.com/sirupsen/logrus"
"github.com/sourcegraph/conc/pool"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -170,8 +171,14 @@ func Explore(cmd *cobra.Command, args []string) error {

_, _ = multi.Stop()

exploreURL := fmt.Sprintf("%v/explore", oi.FrontendUrl)
err = browser.OpenURL(exploreURL)
if err != nil {
pterm.Error.Printf("Unable to open browser: %v", err)
}

pterm.Println()
pterm.Println(fmt.Sprintf("Explore your infrastructure graph at %v/explore", oi.FrontendUrl))
pterm.Println(fmt.Sprintf("Explore your infrastructure graph at %s", exploreURL))
pterm.Println()
pterm.Success.Println("Press Ctrl+C to stop the locally running sources")
err = keyboard.Listen(func(keyInfo keys.Key) (stop bool, err error) {
Expand Down
Loading