Running the application appears to require the command to be given twice #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
To actually perform an action the command has to be given twice like this:
./invoice-generator-v2 generate generate input.txt outputOnly including the command once results in:
Usage: generate generate <csv-file> <output-dir> [--env <name>]Root Cause Analysis
The bug is in
src/main.rs:264-276in theremove_env_flagsfunction.How it works:
parse_env_flag(lines 245-258) looks for--envand returns(Env, index)--envflag exists, it returns(Env::default(), 0)- the index 0The bug (line 269):
When there is NO
--envflag:parse_env_flagreturns index 0args[0](the program name!)args[1]("generate") becomes the newargs[0]Suggested fix: Check if
--envwas actually found before removing anything:Fixed in PR #4 - Commit:
460bb46The issue was in
remove_env_flags()at src/main.rs:264 which returned index 0 when no--envflag was present, incorrectly skipping the first argument (program name). Added early return whenenv_idx == 0to preserve args when no --env flag exists.