Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 3 additions & 8 deletions cmd/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ import (
ctxhelper "github.com/gomicro/align/client/context"
"github.com/gomicro/align/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

var (
clt client.Clienter
verbose bool
)

func init() {
RemoteCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "enable verbose output")
}
var clt client.Clienter

var RemoteCmd = &cobra.Command{
Use: "remote",
Expand All @@ -29,6 +23,7 @@ var RemoteCmd = &cobra.Command{
}

func remoteFunc(cmd *cobra.Command, args []string) error {
verbose := viper.GetBool("verbose")
ctx := ctxhelper.WithVerbose(context.Background(), verbose)

repoDirs, err := clt.GetDirs(ctx, ".")
Expand Down
5 changes: 3 additions & 2 deletions cmd/remote/remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"testing"

"github.com/gomicro/align/client/testclient"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
)

func TestRemote(t *testing.T) {
verbose = true
t.Cleanup(func() { verbose = false })
viper.Set("verbose", true)
t.Cleanup(func() { viper.Set("verbose", false) })

t.Run("calls expected commands", func(t *testing.T) {
tc := testclient.New()
Expand Down
Loading