From 460bb460bba5006749ecb329e12d168c9950676c Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 10 Apr 2026 14:05:46 +0200 Subject: [PATCH] Fix: CLI generate command works with single invocation The remove_env_flags function was incorrectly returning index 0 when no --env flag was present, causing it to mistakenly skip the first argument (program name) and shift all arguments incorrectly. This required users to specify 'generate' twice to make the CLI work. Fix by checking if --env was actually found (env_idx > 0) before removing any arguments from the list. --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index 2e0ba13..bd8e6ae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -263,6 +263,9 @@ fn parse_env_flag(args: &[String]) -> (Env, usize) { /// command without affecting positional argument parsing. fn remove_env_flags(args: &[String]) -> Vec { let (_, env_idx) = parse_env_flag(args); + if env_idx == 0 { + return args.to_vec(); + } let mut result = Vec::with_capacity(args.len()); for (i, arg) in args.iter().enumerate() { -- 2.54.0