Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 6 additions & 1 deletion cmd/project/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type promptObject struct {
Title string // "Reverse string"
Repository string // "slack-samples/reverse-string"
Description string // "A function that reverses a given string"
Subdir string // "agents/hello-world" - subdirectory within the repository
}

const viewMoreSamples = "slack-cli#view-more-samples"
Expand Down Expand Up @@ -158,11 +159,15 @@ func runCreateCommand(clients *shared.ClientFactory, cmd *cobra.Command, args []
}
}

subdir := createSubdirFlag
if subdir == "" {
subdir = template.GetSubdir()
}
createArgs := create.CreateArgs{
AppName: appNameArg,
Template: template,
GitBranch: createGitBranchFlag,
Subdir: createSubdirFlag,
Subdir: subdir,
}
clients.EventTracker.SetAppTemplate(template.GetTemplatePath())

Expand Down
24 changes: 18 additions & 6 deletions cmd/project/create_samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,24 @@ var embedPromptSamplesTmpl string
// promptSampleSelection gathers upstream samples to select from
func promptSampleSelection(ctx context.Context, clients *shared.ClientFactory, sampleRepos []create.GithubRepo) (string, error) {
filteredRepos := []create.GithubRepo{}
selection, err := clients.IO.SelectPrompt(ctx, "Select a language:",
[]string{
fmt.Sprintf("Bolt for JavaScript %s", style.Secondary("Node.js")),
fmt.Sprintf("Bolt for Python %s", style.Secondary("Python")),
fmt.Sprintf("Deno Slack SDK %s", style.Secondary("Deno")),
},
languageOptions := []string{
fmt.Sprintf("Bolt for JavaScript %s", style.Secondary("Node.js")),
fmt.Sprintf("Bolt for Python %s", style.Secondary("Python")),
fmt.Sprintf("Deno Slack SDK %s", style.Secondary("Deno")),
}
if clients.Config.WithExperimentOn(experiment.Templates) {
languageOptions = []string{
"Bolt for JavaScript",
"Bolt for Python",
"Deno Slack SDK",
}
}
Comment thread
zimeg marked this conversation as resolved.
Outdated
languagePrompt := "Select a language:"
if clients.Config.WithExperimentOn(experiment.Templates) {
languagePrompt = "Select a framework:"
}
Comment thread
zimeg marked this conversation as resolved.
Outdated
selection, err := clients.IO.SelectPrompt(ctx, languagePrompt,
languageOptions,
iostreams.SelectPromptConfig{
Flags: []*pflag.Flag{
clients.Config.Flags.Lookup("language"),
Expand Down
Loading
Loading