-
Notifications
You must be signed in to change notification settings - Fork 1.6k
( 📖 ) Enhancements to CLI Help #5498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,20 +43,27 @@ func NewScaffoldCommand() *cobra.Command { | |
| scaffoldCmd := &cobra.Command{ | ||
| Use: "generate", | ||
| Short: "Re-scaffold a Kubebuilder project from its PROJECT file", | ||
| Long: `The 'generate' command re-creates a Kubebuilder project scaffold based on the configuration | ||
| defined in the PROJECT file, using the latest installed Kubebuilder version and plugins. | ||
| Long: `Re-generate a Kubebuilder project scaffold based on the PROJECT file configuration. | ||
|
|
||
| This is helpful for migrating projects to a newer Kubebuilder layout or plugin version (e.g., v3 to v4) | ||
| as update your project from any previous version to the current one. | ||
| This command uses the latest installed Kubebuilder version and plugins to regenerate | ||
| the entire project structure. | ||
|
|
||
| If no output directory is provided, the current working directory will be cleaned (except .git and PROJECT).`, | ||
| This is helpful for migrating projects to newer Kubebuilder | ||
| layouts or plugin version (e.g., v3 to v4) | ||
|
|
||
| This command deletes all files except .git/ and PROJECT before regenerating in-place when | ||
| --output-dir is not specified. | ||
|
|
||
| The PROJECT file must exist and contain valid plugin configuration.`, | ||
| Example: ` | ||
| # **WARNING**(will delete all files to allow the re-scaffold except .git and PROJECT) | ||
| # Re-scaffold the project in-place | ||
| # Re-scaffold in-place (WARNING: deletes all files except .git and PROJECT) | ||
| kubebuilder alpha generate | ||
|
|
||
| # Re-scaffold the project from ./test into ./my-output | ||
| kubebuilder alpha generate --input-dir="./path/to/project" --output-dir="./my-output" | ||
| # Re-scaffold to a different directory (safe, preserves original) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think we need the info under () |
||
| kubebuilder alpha generate --output-dir="./regenerated" | ||
|
|
||
| # Re-scaffold from a specific project directory to a different directory | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original |
||
| kubebuilder alpha generate --input-dir="./my-project" --output-dir="./my-project-v4" | ||
| `, | ||
| PreRunE: func(_ *cobra.Command, _ []string) error { | ||
| return opts.Validate() | ||
|
|
@@ -70,13 +77,12 @@ If no output directory is provided, the current working directory will be cleane | |
| } | ||
|
|
||
| scaffoldCmd.Flags().StringVar(&opts.InputDir, "input-dir", "", | ||
| "Path to the directory containing the PROJECT file. "+ | ||
| "Defaults to the current working directory. WARNING: delete existing files (except .git and PROJECT).") | ||
| "path to directory containing the PROJECT file (default: current directory). "+ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is a good point, what is the best: Should start all with Upper case or not? |
||
| "WARNING: if --output-dir is not set, all files except .git/ and PROJECT will be deleted") | ||
|
|
||
| scaffoldCmd.Flags().StringVar(&opts.OutputDir, "output-dir", "", | ||
| "Directory where the new project scaffold will be written. "+ | ||
| "If unset, re-scaffolding occurs in-place "+ | ||
| "and will delete existing files (except .git and PROJECT).") | ||
| "path to directory where regenerated scaffold will be written. "+ | ||
| "If not set, regenerates in-place and deletes existing files (except .git/ and PROJECT)") | ||
|
|
||
| return scaffoldCmd | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,38 +145,39 @@ Defaults: | |
| } | ||
|
|
||
| updateCmd.Flags().StringVar(&opts.FromVersion, "from-version", "", | ||
| "binary release version to upgrade from. Should match the version used to init the project and be "+ | ||
| "a valid release version, e.g., v4.6.0. If not set, it defaults to the version specified in the PROJECT file.") | ||
| "Kubebuilder version to upgrade from (e.g., v4.6.0). Should match version used to initialize project "+ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think clarify that from. == init version is important. WDYT? |
||
| "If not set, uses version from PROJECT file") | ||
| updateCmd.Flags().StringVar(&opts.ToVersion, "to-version", "", | ||
| "binary release version to upgrade to. Should be a valid release version, e.g., v4.7.0. "+ | ||
| "If not set, it defaults to the latest release version available in the project repository.") | ||
| "Kubebuilder version to upgrade to (e.g., v4.7.0). "+ | ||
| "If not set, uses latest version available in the project repository") | ||
| updateCmd.Flags().StringVar(&opts.FromBranch, "from-branch", "", | ||
| "Git branch to use as current state of the project for the update.") | ||
| "Git branch containing current project state (default: main)") | ||
| updateCmd.Flags().BoolVar(&opts.Force, "force", false, | ||
| "Force the update even if conflicts occur. Conflicted files will include conflict markers, and a "+ | ||
| "commit will be created automatically. Ideal for automation (e.g., cronjobs, CI).") | ||
| "if true, commit even with conflicts (adds conflict markers). "+ | ||
| "Ideal for automation (CI/CD pipelines, cronjobs)") | ||
| updateCmd.Flags().BoolVar(&opts.ShowCommits, "show-commits", false, | ||
| "If set, the update will keep the full history instead of squashing into a single commit.") | ||
| "if true, keep full commit history instead of squashing. "+ | ||
| "Cannot be used with --restore-path") | ||
| updateCmd.Flags().StringArrayVar(&opts.RestorePath, "restore-path", nil, | ||
| "Paths to preserve from the base branch (repeatable). Not supported with --show-commits.") | ||
| "paths to preserve from base branch (repeatable, e.g., --restore-path .github/workflows). "+ | ||
| "Cannot be used with --show-commits") | ||
| updateCmd.Flags().StringVar(&opts.OutputBranch, "output-branch", "", | ||
| "Override the default output branch name (default: kubebuilder-update-from-<from-version>-to-<to-version>).") | ||
| updateCmd.Flags().BoolVar(&opts.Push, "push", false, | ||
| "Push the output branch to the remote repository after the update.") | ||
| "if true, push output branch to origin after update") | ||
| updateCmd.Flags().StringVar(&opts.CommitMessage, "merge-message", "", | ||
| "Custom commit message for successful merges (no conflicts). "+ | ||
| "Defaults to 'chore(kubebuilder): update scaffold <from> -> <to>'.") | ||
| "custom commit message for clean merges (no conflicts)"+ | ||
| "(default: 'chore(kubebuilder): update scaffold <from> -> <to>')") | ||
| updateCmd.Flags().StringVar(&opts.CommitMessageConflict, "conflict-message", "", | ||
| "Custom commit message for merges with conflicts. "+ | ||
| "Defaults to 'chore(kubebuilder): (:warning: manual conflict resolution required) update scaffold <from> -> <to>'.") | ||
| "custom commit message for merges with conflicts. "+ | ||
| "(default: 'chore(kubebuilder): (:warning: manual conflict resolution required) update scaffold <from> -> <to>')") | ||
| updateCmd.Flags().BoolVar(&opts.OpenGhIssue, "open-gh-issue", false, | ||
| "Create a GitHub issue with a pre-filled checklist and compare link after the update completes (requires `gh`).") | ||
| "if true, create GitHub issue with a pre-filled checklist and compare link (requires gh CLI)") | ||
| updateCmd.Flags().BoolVar( | ||
| &opts.UseGhModels, | ||
| "use-gh-models", | ||
| false, | ||
| "Generate and post an AI summary comment to the GitHub Issue using `gh models run`. "+ | ||
| "Requires --open-gh-issue and GitHub CLI (`gh`) with the `gh-models` extension.") | ||
| "if true, add AI-generated summary comment to GitHub issue (requires --open-gh-issue and gh CLI with gh-models extension)") | ||
| updateCmd.Flags().StringArrayVar( | ||
| &gitCfg, | ||
| "git-config", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not accurate. The command will use the code of the CLI version installed/used.
I think the original text here seems more accurate.