Skip to content

Commit 6e1b8a4

Browse files
committed
Refactor command-line argument parsing in cli.py to separate command and its arguments. Update proxy execution to combine command with additional arguments for improved functionality.
1 parent 36f7b73 commit 6e1b8a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/omproxy/cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ def main():
1818
parser.add_argument(
1919
"-v", "--verbose", action="store_true", help="Enable debug logging"
2020
)
21+
parser.add_argument("command", help="Command to run with optional arguments")
2122
parser.add_argument(
22-
"command", nargs="+", help="Command to run with optional arguments"
23+
"args", nargs=argparse.REMAINDER, help="Arguments to pass to the command"
2324
)
2425
args = parser.parse_args()
2526

@@ -37,12 +38,15 @@ def main():
3738

3839
logfire.info("starting_proxy", command=args.command)
3940

41+
# Combine command and args when running the proxy
42+
full_command = [args.command] + args.args
43+
4044
async def run_proxy():
4145
async with Proxy(
4246
lambda line: logfire.info("on_stdin_cb", line=line),
4347
lambda line: logfire.info("on_subprocess_stdout_cb", line=line),
4448
) as proxy:
45-
await proxy.run(args.command)
49+
await proxy.run(full_command)
4650

4751
anyio.run(run_proxy)
4852

0 commit comments

Comments
 (0)