From cec96e9c34e608c5f88b73adce5a32fce76d09e6 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 10 Sep 2021 17:05:31 +0300 Subject: Allow options and vars in any order inside argument groups in pkg-build --- bpkg/bpkg.cxx | 4 ++-- bpkg/pkg-build.cxx | 12 +++++++----- 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 -- cgit v1.1