Skip to content

Commit 46bf065

Browse files
committed
fix: migrate CLI to github.com/urfave/v3
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
1 parent b4e3034 commit 46bf065

File tree

21 files changed

+91
-80
lines changed

21 files changed

+91
-80
lines changed

v2/cli/apply.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"time"
2425

25-
C "github.com/urfave/cli/v2"
26+
C "github.com/urfave/cli/v3"
2627
)
2728

2829
func generateTraverseTuple(f *os.File, i int) {
@@ -422,10 +423,10 @@ func ApplyCommand() *C.Command {
422423
flagCount,
423424
flagFilename,
424425
},
425-
Action: func(ctx *C.Context) error {
426+
Action: func(ctx context.Context, cmd *C.Command) error {
426427
return generateApplyHelpers(
427-
ctx.String(keyFilename),
428-
ctx.Int(keyCount),
428+
cmd.String(keyFilename),
429+
cmd.Int(keyCount),
429430
)
430431
},
431432
}

v2/cli/bind.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"time"
2425

25-
C "github.com/urfave/cli/v2"
26+
C "github.com/urfave/cli/v3"
2627
)
2728

2829
func createCombinations(n int, all, prev []int) [][]int {
@@ -284,10 +285,10 @@ func BindCommand() *C.Command {
284285
flagCount,
285286
flagFilename,
286287
},
287-
Action: func(ctx *C.Context) error {
288+
Action: func(ctx context.Context, cmd *C.Command) error {
288289
return generateBindHelpers(
289-
ctx.String(keyFilename),
290-
ctx.Int(keyCount),
290+
cmd.String(keyFilename),
291+
cmd.Int(keyCount),
291292
)
292293
},
293294
}

v2/cli/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package cli
1717

1818
import (
19-
C "github.com/urfave/cli/v2"
19+
C "github.com/urfave/cli/v3"
2020
)
2121

2222
func Commands() []*C.Command {

v2/cli/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package cli
1717

1818
import (
19-
C "github.com/urfave/cli/v2"
19+
C "github.com/urfave/cli/v3"
2020
)
2121

2222
const (

v2/cli/contextreaderioeither.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"strings"
2425

2526
A "github.com/IBM/fp-go/v2/array"
26-
C "github.com/urfave/cli/v2"
27+
C "github.com/urfave/cli/v3"
2728
)
2829

2930
// Deprecated:
@@ -261,10 +262,10 @@ func ContextReaderIOEitherCommand() *C.Command {
261262
flagCount,
262263
flagFilename,
263264
},
264-
Action: func(ctx *C.Context) error {
265+
Action: func(ctx context.Context, cmd *C.Command) error {
265266
return generateContextReaderIOEitherHelpers(
266-
ctx.String(keyFilename),
267-
ctx.Int(keyCount),
267+
cmd.String(keyFilename),
268+
cmd.Int(keyCount),
268269
)
269270
},
270271
}

v2/cli/di.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"time"
2425

25-
C "github.com/urfave/cli/v2"
26+
C "github.com/urfave/cli/v3"
2627
)
2728

2829
func generateMakeProvider(f *os.File, i int) {
@@ -221,10 +222,10 @@ func DICommand() *C.Command {
221222
flagCount,
222223
flagFilename,
223224
},
224-
Action: func(ctx *C.Context) error {
225+
Action: func(ctx context.Context, cmd *C.Command) error {
225226
return generateDIHelpers(
226-
ctx.String(keyFilename),
227-
ctx.Int(keyCount),
227+
cmd.String(keyFilename),
228+
cmd.Int(keyCount),
228229
)
229230
},
230231
}

v2/cli/either.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"time"
2425

25-
C "github.com/urfave/cli/v2"
26+
C "github.com/urfave/cli/v3"
2627
)
2728

2829
func eitherHKT(typeE string) func(typeA string) string {
@@ -190,10 +191,10 @@ func EitherCommand() *C.Command {
190191
flagCount,
191192
flagFilename,
192193
},
193-
Action: func(ctx *C.Context) error {
194+
Action: func(ctx context.Context, cmd *C.Command) error {
194195
return generateEitherHelpers(
195-
ctx.String(keyFilename),
196-
ctx.Int(keyCount),
196+
cmd.String(keyFilename),
197+
cmd.Int(keyCount),
197198
)
198199
},
199200
}

v2/cli/identity.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"time"
2425

25-
C "github.com/urfave/cli/v2"
26+
C "github.com/urfave/cli/v3"
2627
)
2728

2829
func identityHKT(typeA string) string {
@@ -93,10 +94,10 @@ func IdentityCommand() *C.Command {
9394
flagCount,
9495
flagFilename,
9596
},
96-
Action: func(ctx *C.Context) error {
97+
Action: func(ctx context.Context, cmd *C.Command) error {
9798
return generateIdentityHelpers(
98-
ctx.String(keyFilename),
99-
ctx.Int(keyCount),
99+
cmd.String(keyFilename),
100+
cmd.Int(keyCount),
100101
)
101102
},
102103
}

v2/cli/io.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"time"
2425

2526
A "github.com/IBM/fp-go/v2/array"
26-
C "github.com/urfave/cli/v2"
27+
C "github.com/urfave/cli/v3"
2728
)
2829

2930
func nonGenericIO(param string) string {
@@ -102,10 +103,10 @@ func IOCommand() *C.Command {
102103
flagCount,
103104
flagFilename,
104105
},
105-
Action: func(ctx *C.Context) error {
106+
Action: func(ctx context.Context, cmd *C.Command) error {
106107
return generateIOHelpers(
107-
ctx.String(keyFilename),
108-
ctx.Int(keyCount),
108+
cmd.String(keyFilename),
109+
cmd.Int(keyCount),
109110
)
110111
},
111112
}

v2/cli/ioeither.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
package cli
1717

1818
import (
19+
"context"
1920
"fmt"
2021
"log"
2122
"os"
2223
"path/filepath"
2324
"time"
2425

2526
A "github.com/IBM/fp-go/v2/array"
26-
C "github.com/urfave/cli/v2"
27+
C "github.com/urfave/cli/v3"
2728
)
2829

2930
// [GA ~func() ET.Either[E, A], GB ~func() ET.Either[E, B], GTAB ~func() ET.Either[E, T.Tuple2[A, B]], E, A, B any](a GA, b GB) GTAB {
@@ -273,10 +274,10 @@ func IOEitherCommand() *C.Command {
273274
flagCount,
274275
flagFilename,
275276
},
276-
Action: func(ctx *C.Context) error {
277+
Action: func(ctx context.Context, cmd *C.Command) error {
277278
return generateIOEitherHelpers(
278-
ctx.String(keyFilename),
279-
ctx.Int(keyCount),
279+
cmd.String(keyFilename),
280+
cmd.Int(keyCount),
280281
)
281282
},
282283
}

0 commit comments

Comments
 (0)