From 49887d80b7986ba3df5306ea0aa985034fdb0444 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 4 Jun 2019 13:40:26 +0200 Subject: 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. --- bdep/config.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bdep/config.cxx') 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"; } -- cgit v1.1