Make ... optional in .args (#1086)

This commit is contained in:
Brian 2024-01-16 11:20:50 +11:00 committed by GitHub
parent 6db1200a7e
commit 08793aa143
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View file

@ -91,6 +91,15 @@ int LoadZipArgsImpl(int *argc, char ***argv, char *data) {
}
start = 0;
}
if (!founddots)
{
founddots = true;
for (i = 1; i < *argc; ++i) {
AddZipArg(&n, &args, (*argv)[i]);
}
}
if (founddots || *argc <= 1) {
if (!g_zipargs.initialized) {
atexit(FreeZipArgs);
@ -118,8 +127,9 @@ int LoadZipArgsImpl(int *argc, char ***argv, char *data) {
*
* Your `.args` file should have one argument per line.
*
* If the special argument `...` is *not* encountered, then the
* replacement will only happen if *no* CLI args are specified.
* If the special argument `...` is *not* encountered, then it would be assumed
* that the developer intent is for whatever CLI args were specified by the user
* to be appended to the end
*
* If the special argument `...` *is* encountered, then it'll be
* replaced with whatever CLI args were specified by the user.