aboutsummaryrefslogtreecommitdiff
path: root/bdep/init.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-06-15 23:34:56 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-06-17 18:45:28 +0300
commit064b22135afaf701f7f689ef75136298b9a0d278 (patch)
tree0f09134db6c125eb33e848c79fadcd893b7b25d6 /bdep/init.cxx
parentd2cc9eb93efbb34f5c88d672e04b126b0c422bb3 (diff)
Allow specifying pkg-args in bdep-init -A and -C forms
Diffstat (limited to 'bdep/init.cxx')
-rw-r--r--bdep/init.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/bdep/init.cxx b/bdep/init.cxx
index 782dfe0..30cabb2 100644
--- a/bdep/init.cxx
+++ b/bdep/init.cxx
@@ -23,7 +23,7 @@ namespace bdep
const package_locations& ps,
database& db,
const dir_path& cfg,
- cli::scanner& args,
+ const strings& args,
bool ca,
bool cc)
{
@@ -173,6 +173,11 @@ namespace bdep
return 0;
}
+ // Skip the first `--` separator, if any.
+ //
+ if (args.more () && args.peek () == string ("--"))
+ args.next ();
+
configurations cfgs;
{
// Make sure everyone refers to the same objects across all the
@@ -184,6 +189,16 @@ namespace bdep
//
if (ca || cc)
{
+ strings cfg_args;
+ if (cc)
+ {
+ // Read the configuration arguments until we reach the second `--`
+ // separator or eos.
+ //
+ for (string a; args.more () && (a = args.next ()) != "--"; )
+ cfg_args.push_back (move (a));
+ }
+
cfgs.push_back (
cmd_init_config (
o,
@@ -192,7 +207,7 @@ namespace bdep
load_packages (prj),
db,
ca ? o.config_add () : o.config_create (),
- args,
+ cfg_args,
ca,
cc));
}