aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-10 17:05:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-09-17 14:35:03 +0300
commitcec96e9c34e608c5f88b73adce5a32fce76d09e6 (patch)
tree1910874381338ffb6f19f392b7caaaa2f03a9d49
parentd4a64f8409d872c9ed8e969979d466b320eca927 (diff)
Allow options and vars in any order inside argument groups in pkg-build
-rw-r--r--bpkg/bpkg.cxx4
-rw-r--r--bpkg/pkg-build.cxx12
2 files changed, 9 insertions, 7 deletions
diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx
index 953a5ad..567feff 100644
--- a/bpkg/bpkg.cxx
+++ b/bpkg/bpkg.cxx
@@ -223,8 +223,8 @@ init (const common_options& co,
// Parse the next chunk of options until we reach an argument (or eos).
//
- if (o.parse (scan))
- continue;
+ if (o.parse (scan) && !scan.more ())
+ break;
// Fall through.
}
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 19f351f..30713ec 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -3601,15 +3601,17 @@ namespace bpkg
try
{
cli::scanner& ag (args.group ());
- po.parse (ag, cli::unknown_mode::fail, cli::unknown_mode::stop);
while (ag.more ())
{
- string a (ag.next ());
- if (a.find ('=') == string::npos)
- fail << "unexpected group argument '" << a << "'";
+ if (!po.parse (ag) || ag.more ())
+ {
+ string a (ag.next ());
+ if (a.find ('=') == string::npos)
+ fail << "unexpected group argument '" << a << "'";
- cvs.push_back (move (a));
+ cvs.push_back (move (a));
+ }
}
// We have to manually merge global options into local since just