File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,13 +40,6 @@ type syncFlags struct {
4040 concurrency int
4141}
4242
43- func (f * syncFlags ) validate () error {
44- if f .concurrency < 1 {
45- return errInvalidConcurrency
46- }
47- return nil
48- }
49-
5043func readPatternsFile (filePath string ) ([]string , error ) {
5144 if filePath == "" {
5245 return nil , nil
@@ -207,12 +200,13 @@ func New() *cobra.Command {
207200 return root .MustWorkspaceClient (cmd , args )
208201 }
209202
210- cmd .PreRunE = mustWorkspaceClient
211- cmd .RunE = func (cmd * cobra.Command , args []string ) error {
212- if err := f .validate (); err != nil {
213- return err
203+ cmd .PreRunE = func (cmd * cobra.Command , args []string ) error {
204+ if f .concurrency < 1 {
205+ return errInvalidConcurrency
214206 }
215-
207+ return mustWorkspaceClient (cmd , args )
208+ }
209+ cmd .RunE = func (cmd * cobra.Command , args []string ) error {
216210 var opts * sync.SyncOptions
217211 var err error
218212
Original file line number Diff line number Diff line change @@ -67,17 +67,6 @@ func TestSyncOptionsFromArgs(t *testing.T) {
6767 assert .Equal (t , 7 , opts .Concurrency )
6868}
6969
70- func TestSyncFlagsValidate (t * testing.T ) {
71- f := syncFlags {concurrency : 1 }
72- require .NoError (t , f .validate ())
73-
74- f .concurrency = 0
75- require .ErrorIs (t , f .validate (), errInvalidConcurrency )
76-
77- f .concurrency = - 3
78- require .ErrorIs (t , f .validate (), errInvalidConcurrency )
79- }
80-
8170func TestExcludeFromFlag (t * testing.T ) {
8271 // Create a temporary directory
8372 tempDir := t .TempDir ()
You can’t perform that action at this time.
0 commit comments