arg: use CSV escape style for multiple-value args (#18643)

* arg: use CSV escape style for multiple-value args

* add test
This commit is contained in:
Xuan-Son Nguyen 2026-01-06 17:51:08 +01:00 committed by GitHub
parent ea13cba850
commit 07fbe19f1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 76 additions and 40 deletions

View file

@ -127,6 +127,15 @@ int main(void) {
assert(true == common_params_parse(argv.size(), list_str_to_char(argv).data(), params, LLAMA_EXAMPLE_SPECULATIVE));
assert(params.speculative.n_max == 123);
// multi-value args (CSV)
argv = {"binary_name", "--lora", "file1.gguf,\"file2,2.gguf\",\"file3\"\"3\"\".gguf\",file4\".gguf"};
assert(true == common_params_parse(argv.size(), list_str_to_char(argv).data(), params, LLAMA_EXAMPLE_COMMON));
assert(params.lora_adapters.size() == 4);
assert(params.lora_adapters[0].path == "file1.gguf");
assert(params.lora_adapters[1].path == "file2,2.gguf");
assert(params.lora_adapters[2].path == "file3\"3\".gguf");
assert(params.lora_adapters[3].path == "file4\".gguf");
// skip this part on windows, because setenv is not supported
#ifdef _WIN32
printf("test-arg-parser: skip on windows build\n");