1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-21 20:33:00 +00:00

shell -u argument

This commit is contained in:
Jörn-Michael Miehe 2020-08-24 14:49:17 +02:00
parent 9c198622ca
commit bf0fb911fd

View file

@ -84,13 +84,21 @@ class ShellCommand(ServiceCommand):
help="shell to spawn"
)
# -u argument: Run as user
self._sub_parser.add_argument(
'-u', '--user', type=str,
help="container user to run shell"
)
def _run_services(self, runner, args, project, services):
service = services[0]
shell = _find_shell(args, project, service)
user_args = ['-u', args.user] if args.user else []
if shell is not None:
# spawn shell
project.compose_run(['exec', service, shell])
project.compose_run(['exec', *user_args, service, shell])
return True
return False