aboutsummaryrefslogtreecommitdiff
path: root/bdep/new.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-03-24 11:27:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-03-24 11:27:37 +0200
commitefc78a6f3b0d1e0a2278ea5a7f2c502a6b4f00d0 (patch)
tree025990575942eb95ea128bed82afd58db12ab069 /bdep/new.cxx
parent72711c8f7827bf53027979eec60c9c17fcba0293 (diff)
Document init, add --[no]-default
Diffstat (limited to 'bdep/new.cxx')
-rw-r--r--bdep/new.cxx32
1 files changed, 23 insertions, 9 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx
index d43bfa9..67ba23e 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -22,6 +22,27 @@ namespace bdep
{
tracer trace ("new");
+ 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";
+ }
+
// Validate type options.
//
const type& t (o.type ());
@@ -315,16 +336,8 @@ namespace bdep
// --no-init
//
- bool ca (o.config_add_specified ());
- bool cc (o.config_create_specified ());
-
if (o.no_init ())
- {
- if (ca) fail << "both --no-init and --config-add specified";
- if (cc) fail << "both --no-init and --config-create specified";
-
return 0;
- }
// Create .bdep/.
//
@@ -346,7 +359,8 @@ namespace bdep
db,
ca ? o.config_add () : o.config_create (),
ca,
- cc)};
+ cc,
+ cd)};
package_locations pkgs {{n, dir_path ()}}; // project == package