File tree Expand file tree Collapse file tree 3 files changed +14
-12
lines changed
Expand file tree Collapse file tree 3 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,13 @@ func PhraseLogo() {
4646// Prints the argument if the command is started in non-batch mode
4747func NonBatchPrintf (msg string , args ... interface {}) {
4848 if ! shared .BatchMode {
49- fmt .Print (fmt .Sprintf (msg , args ... ))
49+ fmt .Printf (msg , args ... )
50+ }
51+ }
52+
53+ func NonBatchPrint (msg string ) {
54+ if ! shared .BatchMode {
55+ fmt .Print (msg )
5056 }
5157}
5258
Original file line number Diff line number Diff line change 11package spinner
22
33import (
4- "fmt"
54 "time"
65
7- "github.com/phrase/phrase-cli/cmd/internal/shared "
6+ "github.com/phrase/phrase-cli/cmd/internal/print "
87)
98
109// While executes f, displays an animated spinner while f runs, and stops when f returns.
@@ -33,18 +32,15 @@ func Until(c <-chan struct{}) {
3332
3433// spin animates a spinner until it receives something on the stop channel. It then clears the spinning character and closes the stop channel, signaling that it's done.
3534func spin (stop chan struct {}) {
36- if shared .BatchMode {
37- return
38- }
3935 chars := []string {`-` , `\` , `|` , `/` }
40- fmt . Print (" " )
36+ print . NonBatchPrint (" " )
4137 i := 0
4238 for {
43- fmt . Print ("\b " )
44- fmt . Print (chars [i ])
39+ print . NonBatchPrint ("\b " )
40+ print . NonBatchPrint (chars [i ])
4541 select {
4642 case <- stop :
47- fmt . Print ("\b " )
43+ print . NonBatchPrint ("\b " )
4844 close (stop )
4945 return
5046 case <- time .After (100 * time .Millisecond ):
Original file line number Diff line number Diff line change @@ -215,8 +215,8 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
215215github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c /go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc =
216216github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc =
217217github.com/pelletier/go-toml v1.2.0 /go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic =
218- github.com/phrase/phrase-go/v4 v4.9 .0 h1:V+MWmNrxwrYNtmoY41dgrdWT902Er2hcohtQcpVvWmw =
219- github.com/phrase/phrase-go/v4 v4.9 .0 /go.mod h1:4XplKvrbHS2LDaXfFp9xrVDtO5xk2WHFm0htutwwd8c =
218+ github.com/phrase/phrase-go/v4 v4.18 .0 h1:LSD1izhuwF1TzxlLKdoItfyeSbCuiSs5RCmNiv8vmLg =
219+ github.com/phrase/phrase-go/v4 v4.18 .0 /go.mod h1:4XplKvrbHS2LDaXfFp9xrVDtO5xk2WHFm0htutwwd8c =
220220github.com/pkg/errors v0.8.0 /go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0 =
221221github.com/pkg/errors v0.8.1 /go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0 =
222222github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
You can’t perform that action at this time.
0 commit comments