Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/MAINTAINERS_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

</details>

Expand Down
13 changes: 12 additions & 1 deletion cmd/project/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: FWIW I think --branch has a legit use-case with the slack samples command. However, I get the idea that slack samples is meant to discover the available templates and isn't meant to target advanced use-cases. The slack create command is designed to handle the general-purpose and advanced ones.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwbrooks Thanks for sharing this - I was thinking the same to recommend the create command when creating a specific branch.

I'm wondering if we can revisit this in following change to show samples that have an existing branch when this flag is provided to avoid errors during a git clone?

Will be thinking about this and related docs! 📚

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! All in all, I'm in favour of a simpler samples command and leaving the advanced usage to create.

// 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")

Expand All @@ -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,
})
Expand Down
Loading