aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-unpack.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-08-14 14:36:44 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-08-16 14:53:54 +0300
commited437dbd3483baa3d15d1d86d8f057d9112653b1 (patch)
treecbf3974e8b1774ccccd818442cf042e501190b09 /bpkg/pkg-unpack.cxx
parent80ee886ca0bd3e41434621a056125c92f31b1aea (diff)
Add support for default options files
Diffstat (limited to 'bpkg/pkg-unpack.cxx')
-rw-r--r--bpkg/pkg-unpack.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx
index f289c2f..801496d 100644
--- a/bpkg/pkg-unpack.cxx
+++ b/bpkg/pkg-unpack.cxx
@@ -90,8 +90,8 @@ namespace bpkg
// If the package is inside the configuration, use the relative path.
// This way we can move the configuration around.
//
- c.complete ().normalize ();
- d.complete ().normalize ();
+ normalize (c, "configuration");
+ normalize (d, "package");
if (d.sub (c))
d = d.leaf (c);
@@ -428,4 +428,27 @@ namespace bpkg
return 0;
}
+
+ pkg_unpack_options
+ merge_options (const default_options<pkg_unpack_options>& defs,
+ const pkg_unpack_options& cmd)
+ {
+ return merge_default_options (
+ defs,
+ cmd,
+ [] (const default_options_entry<pkg_unpack_options>& e,
+ const pkg_unpack_options&)
+ {
+ const pkg_unpack_options& o (e.options);
+
+ auto forbid = [&e] (const char* opt, bool specified)
+ {
+ if (specified)
+ fail (e.file) << opt << " in default options file";
+ };
+
+ forbid ("--directory|-d", o.directory_specified ());
+ forbid ("--purge|-p", o.purge ()); // Dangerous.
+ });
+ }
}