@@ -21,6 +21,7 @@ import (
2121 "sort"
2222 "strings"
2323
24+ "github.com/slackapi/slack-cli/internal/experiment"
2425 "github.com/slackapi/slack-cli/internal/iostreams"
2526 "github.com/slackapi/slack-cli/internal/pkg/create"
2627 "github.com/slackapi/slack-cli/internal/shared"
@@ -64,14 +65,26 @@ func promptSampleSelection(ctx context.Context, clients *shared.ClientFactory, s
6465 }
6566
6667 sortedRepos := sortRepos (filteredRepos )
67- selectOptions := createSelectOptions (sortedRepos )
68+ selectOptions := make ([]string , len (sortedRepos ))
69+ for i , r := range sortedRepos {
70+ if ! clients .Config .WithExperimentOn (experiment .Charm ) {
71+ selectOptions [i ] = fmt .Sprint (i + 1 , ". " , r .Name )
72+ } else {
73+ selectOptions [i ] = r .Name
74+ }
75+ }
6876
6977 var selectedTemplate string
7078 selection , err = clients .IO .SelectPrompt (ctx , "Select a sample to build upon:" , selectOptions , iostreams.SelectPromptConfig {
7179 Description : func (value string , index int ) string {
72- return sortedRepos [index ].Description + "\n https://github.com/" + sortedRepos [index ].FullName
80+ desc := sortedRepos [index ].Description
81+ if ! clients .Config .WithExperimentOn (experiment .Charm ) {
82+ desc += "\n https://github.com/" + sortedRepos [index ].FullName
83+ }
84+ return desc
7385 },
7486 Flag : clients .Config .Flags .Lookup ("template" ),
87+ Help : fmt .Sprintf ("Guided tutorials can be found at %s" , style .LinkText ("https://docs.slack.dev/samples" )),
7588 PageSize : 4 , // Supports standard terminal height (24 rows)
7689 Required : true ,
7790 Template : embedPromptSamplesTmpl ,
@@ -127,18 +140,3 @@ func sortRepos(sampleRepos []create.GithubRepo) []create.GithubRepo {
127140 })
128141 return sortedRepos
129142}
130-
131- // createSelectOptions takes in a list of repositories
132- // and returns an array of strings, each value being
133- // equal to the repository name (ie, deno-starter-template)
134- // and prepended with a number for a prompt visual aid
135- func createSelectOptions (filteredRepos []create.GithubRepo ) []string {
136- // Create a slice of repository names to use as
137- // the primary item selection in the prompt
138- selectOptions := make ([]string , 0 )
139- for i , f := range filteredRepos {
140- selectOption := fmt .Sprint (i + 1 , ". " , f .Name )
141- selectOptions = append (selectOptions , selectOption )
142- }
143- return selectOptions
144- }
0 commit comments