8000 Add stack option for CLI start command (#12675) · localstack/localstack@1a9469e · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a9469e

Browse files
gtsiolissilv-ioeruditmorina
authored
Add stack option for CLI start command (#12675)
Co-authored-by: Silvio Vasiljevic <silvio.vasiljevic@gmail.com> Co-authored-by: Erudit Morina <83708693+eruditmorina@users.noreply.github.com>
1 parent 1833df1 commit 1a9469e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

localstack-core/localstack/cli/localstack.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,13 @@ def _print_service_table(services: Dict[str, str]) -> None:
472472
is_flag=True,
473473
default=False,
474474
)
475+
@click.option(
476+
"--stack",
477+
"-s",
478+
type=str,
479+
help="Use a specific stack with optional version. Examples: [localstack:4.5, snowflake]",
480+
required=False,
481+
)
475482
@publish_invocation
476483
def cmd_start(
477484
docker: bool,
@@ -483,6 +490,7 @@ def cmd_start(
483490
publish: Tuple = (),
484491
volume: Tuple = (),
485492
host_dns: bool = False,
493+
stack: str = None,
486494
) -> None:
487495
"""
488496
Start the LocalStack runtime.
@@ -496,6 +504,18 @@ def cmd_start(
496504
if host and detached:
497505
raise CLIError("Cannot start detached in host mode")
498506

507+
if stack:
508+
# Validate allowed stacks
509+
stack_name = stack.split(":")[0]
510+
allowed_stacks = ("localstack", "localstack-pro", "snowflake")
511+
if stack_name.lower() not in allowed_stacks:
512+
raise CLIError(f"Invalid stack '{stack_name}'. Allowed stacks: {allowed_stacks}.")
513+
514+
# Set IMAGE_NAME, defaulting to :latest if no version specified
515+
if ":" not in stack:
516+
stack = f"{stack}:latest"
517+
os.environ["IMAGE_NAME"] = f"localstack/{stack}"
518+
499519
if not no_banner:
500520
print_banner()
501521
print_version()

0 commit comments

Comments
 (0)
0