diff --git a/.github/MAINTAINERS_GUIDE.md b/.github/MAINTAINERS_GUIDE.md index ebc2dbb7..20830fc0 100644 --- a/.github/MAINTAINERS_GUIDE.md +++ b/.github/MAINTAINERS_GUIDE.md @@ -638,7 +638,7 @@ When commands or flags need to be removed, follow these steps: - Recommend alternative flags if available (ex: `internal/config/flags.go`) - Hide the flag from help menus with the `.Hidden` attribute - Optionally use the recommended flag whenever possible -- Somehow mark the command for removal in the next major version +- Somehow mark the flag for removal in the next major version diff --git a/cmd/project/samples.go b/cmd/project/samples.go index 05c3b310..9d91d71e 100644 --- a/cmd/project/samples.go +++ b/cmd/project/samples.go @@ -56,8 +56,13 @@ func NewSamplesCommand(clients *shared.ClientFactory) *cobra.Command { }, } - cmd.Flags().StringVarP(&samplesTemplateURLFlag, "template", "t", "", "template URL for your app") + // DEPRECATED(semver:major): Prefer the create command when repository details are known cmd.Flags().StringVarP(&samplesGitBranchFlag, "branch", "b", "", "name of git branch to checkout") + cmd.Flag("branch").Hidden = true + // DEPRECATED(semver:major): Prefer the create command when repository details are known + cmd.Flags().StringVarP(&samplesTemplateURLFlag, "template", "t", "", "template URL for your app") + cmd.Flag("template").Hidden = true + cmd.Flags().StringVar(&samplesLanguageFlag, "language", "", "runtime for the app framework\n ex: \"deno\", \"node\", \"python\"") cmd.Flags().BoolVar(&samplesListFlag, "list", false, "prints samples without interactivity") @@ -67,6 +72,12 @@ func NewSamplesCommand(clients *shared.ClientFactory) *cobra.Command { // runSamplesCommand prompts for a sample then clones with the create command func runSamplesCommand(clients *shared.ClientFactory, cmd *cobra.Command, args []string) error { ctx := cmd.Context() + + // DEPRECATED(semver:major): Prefer the create command when repository details are known + if cmd.Flag("branch").Changed || cmd.Flag("template").Changed { + clients.IO.PrintWarning(ctx, "DEPRECATED: The `--branch` and `--template` flags are deprecated for the `samples` command; use the `create` command instead") + } + sampler := api.NewHTTPClient(api.HTTPClientOptions{ TotalTimeOut: 60 * time.Second, })