aboutsummaryrefslogtreecommitdiff
path: root/bdep/config.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-06-04 13:40:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-06-04 13:40:26 +0200
commit49887d80b7986ba3df5306ea0aa985034fdb0444 (patch)
treec601f004e42b2ef27c74e5b41d149db4d607856b /bdep/config.cxx
parent7bc20238740dd4b5beeb40e6a84929c7f9c5a751 (diff)
Add --existing|-e option to bdep-{init,new} -C and bdep-config create modes
With this option bdep initializes a bpkg configuration based on an existing build system configuration instead of creating a new one.
Diffstat (limited to 'bdep/config.cxx')
-rw-r--r--bdep/config.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/bdep/config.cxx b/bdep/config.cxx
index 412b753..7c9b45d 100644
--- a/bdep/config.cxx
+++ b/bdep/config.cxx
@@ -52,12 +52,16 @@ namespace bdep
if (o.auto_sync () && o.no_auto_sync ())
fail << "both --auto-sync and --no-auto-sync specified";
+ if (o.existing () && o.wipe ())
+ fail << "both --existing|-e and --wipe specified";
+
return (o.default_ () ? "--default" :
o.no_default () ? "--no-default" :
o.forward () ? "--forward" :
o.no_forward () ? "--no-forward" :
o.auto_sync () ? "--auto-sync" :
o.no_auto_sync () ? "--no-auto-sync" :
+ o.existing () ? "--existing|-e" :
o.wipe () ? "--wipe" : nullptr);
}
@@ -284,7 +288,8 @@ namespace bdep
co,
"create",
"-d", path,
- (ao.wipe () ? "--wipe" : nullptr),
+ (ao.existing () ? "--existing" : nullptr),
+ (ao.wipe () ? "--wipe" : nullptr),
args);
}
@@ -295,7 +300,7 @@ namespace bdep
move (path),
move (name),
id,
- "created");
+ ao.existing () ? "initialized" : "created");
}
static int
@@ -756,6 +761,9 @@ namespace bdep
if (!c.add () && !c.create () && !c.set ())
fail << n << " not valid for this subcommand";
+ if (o.existing () && !c.create ())
+ fail << "--existing|-e is not valid for this subcommand";
+
if (o.wipe () && !c.create ())
fail << "--wipe is not valid for this subcommand";
}