Skip to content

Commit 154828f

Browse files
committed
cli: Pass extra arguments to shell command
1 parent 155b80b commit 154828f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

cli/cloe_launch/__main__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,11 @@ def cli_exec(
176176
multiple=True,
177177
help="Options to pass to Conan for virtualrunenv generation",
178178
)
179+
@click.argument("shell_args", nargs=-1)
179180
@click.pass_obj
180181
def cli_shell(
181182
opt,
183+
shell_args: List[str],
182184
profile: str,
183185
profile_path: str,
184186
preserve_env: bool,
@@ -193,7 +195,7 @@ def cli_shell(
193195
engine.conan_options = conan_option
194196

195197
# Replace process with shell.
196-
engine.shell(use_cache=cache)
198+
engine.shell(shell_args, use_cache=cache)
197199

198200

199201
# _________________________________________________________________________

cli/cloe_launch/exec.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ def init_from_str(self, data: str) -> None:
159159
self._data[kv[0]] = kv[1]
160160
except IndexError:
161161
logging.error(
162-
"Error: cannot interpret environment key-value pair:", line
162+
"Error: cannot interpret environment key-value pair: {}".format(
163+
line
164+
)
163165
)
164166

165167
def __delitem__(self, key: str):
@@ -509,6 +511,7 @@ def clean(self) -> None:
509511

510512
def shell(
511513
self,
514+
arguments: List[str] = None,
512515
use_cache: bool = False,
513516
) -> None:
514517
"""Launch a SHELL with the environment variables adjusted."""
@@ -546,7 +549,10 @@ def shell(
546549

547550
# Replace this process with the SHELL now.
548551
sys.stdout.flush()
549-
os.execvpe(shell, [shell], env.as_dict())
552+
cmd = [shell]
553+
if arguments is not None:
554+
cmd.extend(arguments)
555+
os.execvpe(shell, cmd, env.as_dict())
550556

551557
def exec(
552558
self,

0 commit comments

Comments
 (0)