aboutsummaryrefslogtreecommitdiff
path: root/bdep/config.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/config.cxx
parent72711c8f7827bf53027979eec60c9c17fcba0293 (diff)
Document init, add --[no]-default
Diffstat (limited to 'bdep/config.cxx')
-rw-r--r--bdep/config.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/bdep/config.cxx b/bdep/config.cxx
index 9f94a29..12a6e61 100644
--- a/bdep/config.cxx
+++ b/bdep/config.cxx
@@ -32,6 +32,14 @@ namespace bdep
//
if (!def)
def = (db.query_value<count> () == 0);
+ else if (*def)
+ {
+ using query = bdep::query<configuration>;
+
+ if (auto p = db.query_one<configuration> (query::default_))
+ fail << "configuration " << *p << " is already the default" <<
+ info << "use 'bdep config set --no-default' to clear";
+ }
// Make sure the configuration path is absolute and normalized. Also
// derive relative to project directory path is possible.
@@ -95,11 +103,15 @@ namespace bdep
cmd_config (const cmd_config_options& o, cli::scanner&)
{
//@@ TODO: get subcommand and pass to tracer.
+ //@@ TODO: define a CLI options class for subcommands?
tracer trace ("config");
//@@ TODO: validate project/config options for subcommands.
+ if (o.default_ () && o.no_default ())
+ fail << "both --default and --no-default specified";
+
for (const string& n: o.config_name ())
text << n;