Skip to content

Commit 6e12966

Browse files
committed
Add 'manage services' command
1 parent a2e6d43 commit 6e12966

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

docs/cli.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ Follow logs (limited to _n_ lines):
131131
$ stack manage --deployment-dir ~/deployments/todo logs -f -n 10
132132
```
133133

134+
List service names:
135+
```
136+
$ stack manage --dir ~/deployments/todo services
137+
```
138+
134139
Execute a command in a running container:
135140
```
136141
$ stack manage --dir ~/deployments/todo exec frontend 'node --version'

src/stack/deploy/deployment.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
1616

1717
import click
18-
from pathlib import Path
1918
import sys
19+
20+
from pathlib import Path
21+
2022
from stack import constants
2123
from stack.deploy.images import push_images_operation
2224
from stack.deploy.deploy import (
@@ -34,6 +36,7 @@
3436
)
3537
from stack.deploy.deploy_types import DeployCommandContext
3638
from stack.deploy.deployment_context import DeploymentContext
39+
from stack.deploy.stack import Stack
3740

3841

3942
@click.group()
@@ -173,3 +176,14 @@ def reload(ctx):
173176
"""reload the stack to pick up config changes"""
174177
ctx.obj = make_deploy_context(ctx)
175178
update_operation(ctx)
179+
180+
181+
@command.command()
182+
@click.pass_context
183+
def services(ctx):
184+
"""list stack service names"""
185+
ctx.obj = make_deploy_context(ctx)
186+
stack = Stack(ctx.obj.stack).init_from_file(ctx.obj.stack.joinpath(constants.stack_file_name))
187+
services = list(stack.get_services().keys())
188+
services.sort()
189+
print("\n".join(services))

0 commit comments

Comments
 (0)