aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/b-cmdline.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/b-cmdline.cxx')
-rw-r--r--libbuild2/b-cmdline.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/libbuild2/b-cmdline.cxx b/libbuild2/b-cmdline.cxx
index 2e2deb8..206c9de 100644
--- a/libbuild2/b-cmdline.cxx
+++ b/libbuild2/b-cmdline.cxx
@@ -286,8 +286,25 @@ namespace build2
{
optional<dir_path> extra;
if (ops.default_options_specified ())
+ {
extra = ops.default_options ();
+ // Note that load_default_options() expects absolute and normalized
+ // directory.
+ //
+ try
+ {
+ if (extra->relative ())
+ extra->complete ();
+
+ extra->normalize ();
+ }
+ catch (const invalid_path& e)
+ {
+ fail << "invalid --default-options value " << e.path;
+ }
+ }
+
// Load default options files.
//
default_options<b_options> def_ops (
@@ -396,8 +413,26 @@ namespace build2
if (ops.progress () && ops.no_progress ())
fail << "both --progress and --no-progress specified";
+ if (ops.diag_color () && ops.no_diag_color ())
+ fail << "both --diag-color and --no-diag-color specified";
+
if (ops.mtime_check () && ops.no_mtime_check ())
fail << "both --mtime-check and --no-mtime-check specified";
+
+ if (ops.match_only () && ops.load_only ())
+ fail << "both --match-only and --load-only specified";
+
+ if (!ops.dump_specified ())
+ {
+ // Note: let's allow specifying --dump-format without --dump in case
+ // it comes from a default options file or some such.
+
+ if (ops.dump_target_specified ())
+ fail << "--dump-target requires --dump";
+
+ if (ops.dump_scope_specified ())
+ fail << "--dump-scope requires --dump";
+ }
}
catch (const cli::exception& e)
{
@@ -416,6 +451,9 @@ namespace build2
r.progress = (ops.progress () ? optional<bool> (true) :
ops.no_progress () ? optional<bool> (false) : nullopt);
+ r.diag_color = (ops.diag_color () ? optional<bool> (true) :
+ ops.no_diag_color () ? optional<bool> (false) : nullopt);
+
r.mtime_check = (ops.mtime_check () ? optional<bool> (true) :
ops.no_mtime_check () ? optional<bool> (false) : nullopt);