-
Notifications
You must be signed in to change notification settings - Fork 5
Select default emulator on first run #217
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
Merged
anisaoshafi
merged 22 commits into
main
from
drg-381-add-option-to-select-default-emulator
May 7, 2026
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0c17622
Select default emulator on first run
anisaoshafi d7fcdfb
Parallelize new tests
anisaoshafi ea7166a
Remove error & rename message for default emulator
anisaoshafi d6713e3
Match single quotes in config & handle commented section in detectBlo…
anisaoshafi d2e8857
Assert error from runLstk
anisaoshafi 796b7ae
Move ParseEmulatorType to its domain package
anisaoshafi 8b35fa3
Make switch_test.go tests table-driven
anisaoshafi b6dc825
Strong-type --emulator, validate early
anisaoshafi a18bb3b
Remove callback in startEmulator: handle in run.go
anisaoshafi ad2945f
Remove ParseEmulatorType in favor of ParseOptionalEmulatorType
anisaoshafi b52e540
Gentler message on changing configuration
anisaoshafi b177aa7
Avoid duplicating config content
anisaoshafi 4afa6fc
Skip keyboard shortcuts for emulator selection
anisaoshafi 49c7698
Nits
anisaoshafi 31cb5b9
Split emulator-selected note into two message events: change configur…
anisaoshafi d651cd8
Simplify: Remove --emulator flag on start
anisaoshafi fe93529
Move domain code to proper place
anisaoshafi 62926ca
Refactor display name related functions
anisaoshafi b4fc4cf
Reuse for emulator name
anisaoshafi 6ced3fe
Get rid of initConfigCapturingFirstRun
anisaoshafi 238b97a
Enhance test by capturing user input & persisting in config
anisaoshafi 3d88700
New test: emulator selection not triggered when config exists
anisaoshafi 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
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
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
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
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
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
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
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 |
|---|---|---|
|
|
@@ -25,6 +25,24 @@ var emulatorDisplayNames = map[EmulatorType]string{ | |
| EmulatorAzure: "Azure", | ||
| } | ||
|
|
||
| // SelectableEmulatorTypes lists the emulator types available for interactive selection, | ||
| // in the order they should be presented. The selection key for each type is its first character. | ||
| var SelectableEmulatorTypes = []EmulatorType{EmulatorAWS, EmulatorSnowflake} | ||
|
|
||
| func (e EmulatorType) SelectionKey() string { | ||
| return string(e)[0:1] | ||
| } | ||
|
|
||
| func (e EmulatorType) ShortName() string { | ||
| if name, ok := emulatorDisplayNames[e]; ok { | ||
| return name | ||
| } | ||
| return string(e) | ||
| } | ||
|
Collaborator
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. question: we already have
Contributor
Author
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. Tried here: 62926ca |
||
|
|
||
| func (e EmulatorType) DisplayName() string { | ||
| return fmt.Sprintf("LocalStack %s Emulator", e.ShortName()) | ||
| } | ||
| var emulatorHealthPaths = map[EmulatorType]string{ | ||
| EmulatorAWS: "/_localstack/health", | ||
| EmulatorSnowflake: "/_localstack/health", | ||
|
|
@@ -68,13 +86,6 @@ func KnownImageReposForType(t EmulatorType) []string { | |
| return repos | ||
| } | ||
|
|
||
| func DisplayNameForType(t EmulatorType) string { | ||
| name, ok := emulatorDisplayNames[t] | ||
| if !ok { | ||
| return fmt.Sprintf("LocalStack %s Emulator", t) | ||
| } | ||
| return fmt.Sprintf("LocalStack %s Emulator", name) | ||
| } | ||
|
|
||
| type ContainerConfig struct { | ||
| Type EmulatorType `mapstructure:"type"` | ||
|
|
@@ -168,7 +179,7 @@ func (c *ContainerConfig) ContainerPort() (string, error) { | |
| } | ||
|
|
||
| func (c *ContainerConfig) DisplayName() string { | ||
| return DisplayNameForType(c.Type) | ||
| return c.Type.DisplayName() | ||
| } | ||
|
|
||
| func (c *ContainerConfig) ProductName() (string, error) { | ||
|
|
||
Oops, something went wrong.
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.
question: do we really need 2 functions
initConfigandinitConfigCapturingFirstRun? They look quite similarThere 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.
Good point, tried here: 6ced3fe