-
Notifications
You must be signed in to change notification settings - Fork 26
feat(cmd): add 'list' flag to create command #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
srtaalej
wants to merge
2
commits into
main
Choose a base branch
from
ale-list-flag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+84
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| package project | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "strings" | ||
| "time" | ||
|
|
@@ -240,6 +241,42 @@ func confirmExternalTemplateSelection(cmd *cobra.Command, clients *shared.Client | |
| return true, nil | ||
| } | ||
|
|
||
| // listTemplates prints available templates for the create command | ||
| func listTemplates(ctx context.Context, clients *shared.ClientFactory, categoryShortcut string) error { | ||
| type categoryInfo struct { | ||
| id string | ||
| name string | ||
| } | ||
|
|
||
| var categories []categoryInfo | ||
| if categoryShortcut == "agent" { | ||
| categories = []categoryInfo{ | ||
| {id: "slack-cli#ai-apps", name: "AI Agent apps"}, | ||
| } | ||
| } else { | ||
| categories = []categoryInfo{ | ||
| {id: "slack-cli#getting-started", name: "Getting started"}, | ||
| {id: "slack-cli#ai-apps", name: "AI Agent apps"}, | ||
| {id: "slack-cli#automation-apps", name: "Automation apps"}, | ||
| } | ||
| } | ||
|
|
||
| for _, category := range categories { | ||
| templates := getSelectionOptions(clients, category.id) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ praise: This is a nice filter setup! |
||
| secondary := make([]string, len(templates)) | ||
| for i, tmpl := range templates { | ||
| secondary[i] = tmpl.Repository | ||
| } | ||
| clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ | ||
| Emoji: "house_buildings", | ||
| Text: style.Bold(category.name), | ||
| Secondary: secondary, | ||
| })) | ||
srtaalej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| // getSelectionTemplate returns a custom formatted template used for selecting a | ||
| // project template during creation | ||
| func getSelectionTemplate(clients *shared.ClientFactory) string { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion(non-blocking): Not a deal breaker, but I don't like that we're duplicating the categories in 2 areas. In
getSelectionOptionsForCategory(...)we already list the category titles and now we're duplicating the categories here. We're also slightly changing the titles ("AI Agent app" vs "AI Agent apps" / "Starter app" vs "Getting started"). This will become more error-prone if we add or change categories later on.We don't need to refactor this if it's complicated, but we should at least add a comment in both sections noting that changes must occur in the other section. And we should try to keep the naming consistent.