Skip to content

Commit

Permalink
Merge pull request #1855 from russellb/nexctl-peers-ping-output
Browse files Browse the repository at this point in the history
nexctl: Don't use spinner for parseable output
  • Loading branch information
mergify[bot] authored Jan 24, 2024
2 parents e9ffe4e + e653d22 commit 3e841ad
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions cmd/nexctl/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/nexodus-io/nexodus/internal/api"
"golang.org/x/exp/maps"
"os"
"sort"
"time"

"github.com/nexodus-io/nexodus/internal/api"
"golang.org/x/exp/maps"

"github.com/briandowns/spinner"
"github.com/fatih/color"
"github.com/urfave/cli/v3"
Expand Down Expand Up @@ -45,19 +46,25 @@ func cmdConnStatus(ctx context.Context, command *cli.Command, family string) err
return err
}

// start spinner
s := spinner.New(spinner.CharSets[70], 100*time.Millisecond)
s.Suffix = " Running Probe..."
s.Start()
var s *spinner.Spinner
if command.String("output") == encodeColumn {
// start spinner, but only for human readable output format,
// not when generating parseable output.
s = spinner.New(spinner.CharSets[70], 100*time.Millisecond)
s.Suffix = " Running Probe..."
s.Start()
}

result, err := callNexdKeepalives(family)
if err != nil {
// clear spinner on error return
fmt.Print("\r \r")
return err
}
// stop spinner
s.Stop()
if s != nil {
// stop spinner
s.Stop()
}
// clear spinner
fmt.Print("\r \r")

Expand Down

0 comments on commit 3e841ad

Please sign in to comment.