From ef2b14552f93d9e1fe3b618627a1dcef80a61247 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sun, 27 Apr 2025 10:56:02 +1200 Subject: [PATCH 1/3] docs: add renames to v3 migration doc --- docs/migrate-v2-to-v3.md | 124 +++++++++++++++++++++++++++++++++------ 1 file changed, 106 insertions(+), 18 deletions(-) diff --git a/docs/migrate-v2-to-v3.md b/docs/migrate-v2-to-v3.md index 1b023ffcfd..ad2c566d17 100644 --- a/docs/migrate-v2-to-v3.md +++ b/docs/migrate-v2-to-v3.md @@ -23,6 +23,112 @@ Check each file for this and make the change. Shell command to find them all: `fgrep -rl github.com/urfave/cli/v2 *` +## New Names + +### cli.App + +=== "v2" + + ```go + cli.App{ + // ... + } + ``` + +=== "v3" + + ```go + cli.Command{ + // ... + } + ``` + +### cli.App.EnableBashCompletion + +=== "v2" + + ```go + cli.App{ + EnableBashCompletion: true, + } + ``` + +=== "v3" + + ```go + cli.Command{ + EnableShellCompletion: true, + } + ``` + +### cli.App.CustomAppHelpTemplate + +=== "v2" + + ```go + cli.App{ + CustomAppHelpTemplate: "...", + } + ``` + +=== "v3" + + ```go + cli.Command{ + CustomRootCommandHelpTemplate: "...", + } + ``` + +### cli.App.RunContext + +=== "v2" + + ```go + (&cli.App{}).RunContext(context.Background(), os.Args) + ``` + +=== "v3" + + ```go + (&cli.Command{}).Run(context.Background(), os.Args) + ``` + +### cli.App.BashComplete + +=== "v2" + + ```go + cli.App{ + BashComplete: func(ctx *cli.Context) {}, + } + ``` + +=== "v3" + + ```go + cli.Command{ + ShellComplete: func(ctx context.Context, cmd *cli.Command) {}, + } + ``` + +### cli.Command.Subcommands + +=== "v2" + + ```go + cli.Command{ + Subcommands: []*cli.Command{}, + } + ``` + +=== "v3" + + ```go + cli.Command{ + Commands: []*cli.Command{}, + } + ``` + ## Sources ### FilePath @@ -295,21 +401,3 @@ Similar messages would be shown for other funcs. }, } ``` - -## BashCompletion/ShellCompletion - -=== "v2" - - ```go - &cli.App{ - EnableBashCompletion: true, - } - ``` - -=== "v3" - - ```go - &cli.Command{ - EnableShellCompletion: true, - } - ``` From a1f65a0f654db5c9f5dffc394fb69b9b53b3545d Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sun, 27 Apr 2025 11:32:45 +1200 Subject: [PATCH 2/3] docs: add `Float64` -> `Float` --- docs/migrate-v2-to-v3.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/migrate-v2-to-v3.md b/docs/migrate-v2-to-v3.md index ad2c566d17..31d71ca461 100644 --- a/docs/migrate-v2-to-v3.md +++ b/docs/migrate-v2-to-v3.md @@ -129,6 +129,40 @@ Shell command to find them all: `fgrep -rl github.com/urfave/cli/v2 *` } ``` +### cli.Float64Flag + +=== "v2" + + ```go + cli.Float64Flag{ + // ... + } + ``` + +=== "v3" + + ```go + cli.FloatFlag{ + // ... + } + ``` + +### cli.Context.Float64 + +=== "v2" + + ```go + // ctx is cli.Context + ctx.Float64("my-floating-flag") + ``` + +=== "v3" + + ```go + // cmd is cli.Command + cmd.Float("my-floating-flag") + ``` + ## Sources ### FilePath From a8fb70ed475d1e6df6dd12e35276e9fcf17bdec9 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Mon, 28 Apr 2025 07:17:12 +1200 Subject: [PATCH 3/3] docs: remove section about `Float64` --- docs/migrate-v2-to-v3.md | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/docs/migrate-v2-to-v3.md b/docs/migrate-v2-to-v3.md index 31d71ca461..ad2c566d17 100644 --- a/docs/migrate-v2-to-v3.md +++ b/docs/migrate-v2-to-v3.md @@ -129,40 +129,6 @@ Shell command to find them all: `fgrep -rl github.com/urfave/cli/v2 *` } ``` -### cli.Float64Flag - -=== "v2" - - ```go - cli.Float64Flag{ - // ... - } - ``` - -=== "v3" - - ```go - cli.FloatFlag{ - // ... - } - ``` - -### cli.Context.Float64 - -=== "v2" - - ```go - // ctx is cli.Context - ctx.Float64("my-floating-flag") - ``` - -=== "v3" - - ```go - // cmd is cli.Command - cmd.Float("my-floating-flag") - ``` - ## Sources ### FilePath