Skip to content

Commit dd44ec5

Browse files
zimegmwbrooks
andauthored
feat: deprecate the "branch" and "template" flag for the samples command (#193)
Co-authored-by: Michael Brooks <[email protected]>
1 parent 1d23e94 commit dd44ec5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/MAINTAINERS_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ When commands or flags need to be removed, follow these steps:
638638
- Recommend alternative flags if available (ex: `internal/config/flags.go`)
639639
- Hide the flag from help menus with the `.Hidden` attribute
640640
- Optionally use the recommended flag whenever possible
641-
- Somehow mark the command for removal in the next major version
641+
- Somehow mark the flag for removal in the next major version
642642
643643
</details>
644644

cmd/project/samples.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ func NewSamplesCommand(clients *shared.ClientFactory) *cobra.Command {
5656
},
5757
}
5858

59-
cmd.Flags().StringVarP(&samplesTemplateURLFlag, "template", "t", "", "template URL for your app")
59+
// DEPRECATED(semver:major): Prefer the create command when repository details are known
6060
cmd.Flags().StringVarP(&samplesGitBranchFlag, "branch", "b", "", "name of git branch to checkout")
61+
cmd.Flag("branch").Hidden = true
62+
// DEPRECATED(semver:major): Prefer the create command when repository details are known
63+
cmd.Flags().StringVarP(&samplesTemplateURLFlag, "template", "t", "", "template URL for your app")
64+
cmd.Flag("template").Hidden = true
65+
6166
cmd.Flags().StringVar(&samplesLanguageFlag, "language", "", "runtime for the app framework\n ex: \"deno\", \"node\", \"python\"")
6267
cmd.Flags().BoolVar(&samplesListFlag, "list", false, "prints samples without interactivity")
6368

@@ -67,6 +72,12 @@ func NewSamplesCommand(clients *shared.ClientFactory) *cobra.Command {
6772
// runSamplesCommand prompts for a sample then clones with the create command
6873
func runSamplesCommand(clients *shared.ClientFactory, cmd *cobra.Command, args []string) error {
6974
ctx := cmd.Context()
75+
76+
// DEPRECATED(semver:major): Prefer the create command when repository details are known
77+
if cmd.Flag("branch").Changed || cmd.Flag("template").Changed {
78+
clients.IO.PrintWarning(ctx, "DEPRECATED: The `--branch` and `--template` flags are deprecated for the `samples` command; use the `create` command instead")
79+
}
80+
7081
sampler := api.NewHTTPClient(api.HTTPClientOptions{
7182
TotalTimeOut: 60 * time.Second,
7283
})

0 commit comments

Comments
 (0)