aboutsummaryrefslogtreecommitdiff
path: root/bdep/new.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-04-26 09:48:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-04-26 09:48:58 +0200
commite86333fa8790f624d82ecea2a8da40f85a1d3630 (patch)
tree91166f5070c5a43310faa3883030ccdf23182193 /bdep/new.cxx
parent7839410d934bb36fdac2e4125c72febf73991320 (diff)
Add support for forwarded configurations
Diffstat (limited to 'bdep/new.cxx')
-rw-r--r--bdep/new.cxx30
1 files changed, 17 insertions, 13 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 97c8352..5f99e6c 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -9,6 +9,7 @@
#include <bdep/diagnostics.hxx>
#include <bdep/init.hxx>
+#include <bdep/config.hxx>
using namespace std;
@@ -26,24 +27,18 @@ namespace bdep
bool ca (o.config_add_specified ());
bool cc (o.config_create_specified ());
- optional<bool> cd;
- if (o.default_ () || o.no_default ())
- {
- if (!ca && !cc)
- fail << "--[no-]default specified without --config-(add|create)";
-
- if (o.default_ () && o.no_default ())
- fail << "both --default and --no-default specified";
-
- cd = o.default_ () && !o.no_default ();
- }
-
if (o.no_init ())
{
if (ca) fail << "both --no-init and --config-add specified";
if (cc) fail << "both --no-init and --config-create specified";
}
+ if (const char* n = cmd_config_validate_add (o))
+ {
+ if (!ca && !cc)
+ fail << n << " specified without --config-(add|create)";
+ }
+
// Validate type options.
//
const type& t (o.type ());
@@ -621,6 +616,14 @@ namespace bdep
if (ca || cc)
{
+ optional<bool> cd;
+ if (o.default_ () || o.no_default ())
+ cd = o.default_ () && !o.no_default ();
+
+ optional<bool> cf;
+ if (o.forward () || o.no_forward ())
+ cf = o.forward () && !o.no_forward ();
+
configurations cfgs {
cmd_init_config (
o,
@@ -630,7 +633,8 @@ namespace bdep
args,
ca,
cc,
- cd)};
+ cd,
+ cf)};
package_locations pkgs {{n, dir_path ()}}; // project == package