aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-09-09 20:53:30 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-09-09 21:08:25 +0300
commitcce2cd1db97c4f7b28ca5a27541bad14fc073cdc (patch)
treef127e8c720b8e5a6e32172d5d0e9a3c672b4d2ed
parent03af0079fa113d81c8a9da17434cf0b7f5db5504 (diff)
Make changes required for CI
-rw-r--r--bdep/argument-grouping.cxx84
-rw-r--r--bdep/argument-grouping.hxx31
-rw-r--r--bdep/bdep-options.cxx1711
-rw-r--r--bdep/bdep-options.hxx485
-rw-r--r--bdep/bdep-options.ixx387
-rw-r--r--bdep/ci-options.cxx1231
-rw-r--r--bdep/ci-options.hxx345
-rw-r--r--bdep/ci-options.ixx417
-rw-r--r--bdep/clean-options.cxx758
-rw-r--r--bdep/clean-options.hxx139
-rw-r--r--bdep/clean-options.ixx57
-rw-r--r--bdep/common-options.cxx2034
-rw-r--r--bdep/common-options.hxx1012
-rw-r--r--bdep/common-options.ixx989
-rw-r--r--bdep/config-options.cxx1336
-rw-r--r--bdep/config-options.hxx293
-rw-r--r--bdep/config-options.ixx186
-rw-r--r--bdep/database-views-odb.cxx233
-rw-r--r--bdep/database-views-odb.hxx148
-rw-r--r--bdep/database-views-odb.ixx27
-rw-r--r--bdep/default-options-files.cxx91
-rw-r--r--bdep/default-options-files.hxx31
-rw-r--r--bdep/deinit-options.cxx749
-rw-r--r--bdep/deinit-options.hxx139
-rw-r--r--bdep/deinit-options.ixx57
-rw-r--r--bdep/fetch-options.cxx730
-rw-r--r--bdep/fetch-options.hxx129
-rw-r--r--bdep/fetch-options.ixx39
-rw-r--r--bdep/help-options.cxx680
-rw-r--r--bdep/help-options.hxx119
-rw-r--r--bdep/help-options.ixx21
-rw-r--r--bdep/init-options.cxx1109
-rw-r--r--bdep/init-options.hxx261
-rw-r--r--bdep/init-options.ixx273
-rw-r--r--bdep/new-options.cxx5392
-rw-r--r--bdep/new-options.hxx1696
-rw-r--r--bdep/new-options.ixx1665
-rw-r--r--bdep/project-odb.cxx1676
-rw-r--r--bdep/project-odb.hxx636
-rw-r--r--bdep/project-odb.ixx94
-rw-r--r--bdep/project-options.cxx1619
-rw-r--r--bdep/project-options.hxx460
-rw-r--r--bdep/project-options.ixx339
-rw-r--r--bdep/projects-configs.cxx103
-rw-r--r--bdep/projects-configs.hxx31
-rw-r--r--bdep/publish-options.cxx986
-rw-r--r--bdep/publish-options.hxx260
-rw-r--r--bdep/publish-options.ixx267
-rw-r--r--bdep/release-options.cxx1318
-rw-r--r--bdep/release-options.hxx408
-rw-r--r--bdep/release-options.ixx531
-rw-r--r--bdep/status-options.cxx904
-rw-r--r--bdep/status-options.hxx169
-rw-r--r--bdep/status-options.ixx111
-rw-r--r--bdep/sync-options.cxx1631
-rw-r--r--bdep/sync-options.hxx447
-rw-r--r--bdep/sync-options.ixx462
-rw-r--r--bdep/test-options.cxx758
-rw-r--r--bdep/test-options.hxx139
-rw-r--r--bdep/test-options.ixx57
-rw-r--r--bdep/update-options.cxx758
-rw-r--r--bdep/update-options.hxx139
-rw-r--r--bdep/update-options.ixx57
-rw-r--r--buildfile2
-rw-r--r--repositories.manifest6
65 files changed, 39447 insertions, 5 deletions
diff --git a/bdep/argument-grouping.cxx b/bdep/argument-grouping.cxx
new file mode 100644
index 0000000..b5796c0
--- /dev/null
+++ b/bdep/argument-grouping.cxx
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/argument-grouping.hxx>
+
+#include <map>
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_argument_grouping_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep\033[0m \033[1m{\033[0m \033[4moptions\033[0m \033[1m}+\033[0m \033[4margument\033[0m \033[1m+{\033[0m \033[4moptions\033[0m \033[1m}\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "For certain commands certain options and command line variables can be grouped" << ::std::endl
+ << "to only apply to specific arguments. This help topic describes the argument" << ::std::endl
+ << "grouping facility used for this purpose." << ::std::endl
+ << ::std::endl
+ << "Groups can be specified before (leading) and/or after (trailing) the argument" << ::std::endl
+ << "they apply to. A leading group starts with '\033[1m{\033[0m' and ends with '\033[1m}+\033[0m' while a" << ::std::endl
+ << "trailing group starts with '\033[1m+{\033[0m' and ends with '\033[1m}\033[0m'. For example:" << ::std::endl
+ << ::std::endl
+ << "{ --foo --bar }+ arg # 'arg' with '--foo' '--bar'" << ::std::endl
+ << "arg +{ fox=1 baz=2 } # 'arg' with 'fox=1' 'baz=2'" << ::std::endl
+ << ::std::endl
+ << "Multiple leading and/or trailing groups can be specified for the same argument." << ::std::endl
+ << "For example:" << ::std::endl
+ << ::std::endl
+ << "{ -f }+ { -b }+ arg +{ f=1 } +{ b=2 } # 'arg' with '-f' 'b' 'f=1' 'b=2'" << ::std::endl
+ << ::std::endl
+ << "The group applies to a single argument only unless multiple arguments are" << ::std::endl
+ << "themselves grouped with '\033[1m{\033[0m' and '\033[1m}\033[0m'. For example:" << ::std::endl
+ << ::std::endl
+ << "{ --foo }+ arg1 arg2 +{ --bar } # 'arg1' with '--foo'" << ::std::endl
+ << " # 'arg2' with '--bar'" << ::std::endl
+ << ::std::endl
+ << "{ --foo }+ { arg1 arg2 } +{ --bar } # 'arg1' with '--foo' '--bar'" << ::std::endl
+ << " # 'arg2' with '--foo' '--bar'" << ::std::endl
+ << ::std::endl
+ << "The group separators ('\033[1m{\033[0m', '\033[1m}+'\033[0m, etc) must be separate command line arguments." << ::std::endl
+ << "In particular, they must not be adjacent either to the arguments inside the" << ::std::endl
+ << "group nor to the argument they apply to. All such cases will be treated as" << ::std::endl
+ << "ordinary arguments. For example:" << ::std::endl
+ << ::std::endl
+ << "{--foo}+ arg # '{--foo}+' ..." << ::std::endl
+ << "arg+{ --foo } # 'arg+{' ..." << ::std::endl
+ << ::std::endl
+ << "If one of the group separators needs to be specified as an argument verbatim," << ::std::endl
+ << "then it must be escaped with '\033[1m\\\033[0m'. For example:" << ::std::endl
+ << ::std::endl
+ << "} # error: unexpected group separator" << ::std::endl
+ << "}x # '}x'" << ::std::endl
+ << "\\} # '}'" << ::std::endl
+ << "{ \\}+ }+ arg # 'arg' with '}+'" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/argument-grouping.hxx b/bdep/argument-grouping.hxx
new file mode 100644
index 0000000..a89eb16
--- /dev/null
+++ b/bdep/argument-grouping.hxx
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_ARGUMENT_GROUPING_HXX
+#define BDEP_ARGUMENT_GROUPING_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/common-options.hxx>
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_argument_grouping_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_ARGUMENT_GROUPING_HXX
diff --git a/bdep/bdep-options.cxx b/bdep/bdep-options.cxx
new file mode 100644
index 0000000..e6e0a73
--- /dev/null
+++ b/bdep/bdep-options.cxx
@@ -0,0 +1,1711 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/bdep-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // commands
+ //
+
+ commands::
+ commands ()
+ : help_ (),
+ new__ (),
+ init_ (),
+ sync_ (),
+ fetch_ (),
+ status_ (),
+ ci_ (),
+ release_ (),
+ publish_ (),
+ deinit_ (),
+ config_ (),
+ test_ (),
+ update_ (),
+ clean_ ()
+ {
+ }
+
+ bool commands::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool commands::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool commands::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool commands::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool commands::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void commands::
+ merge (const commands& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.help_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->help_, a.help_);
+ }
+
+ if (a.new__)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->new__, a.new__);
+ }
+
+ if (a.init_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->init_, a.init_);
+ }
+
+ if (a.sync_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sync_, a.sync_);
+ }
+
+ if (a.fetch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->fetch_, a.fetch_);
+ }
+
+ if (a.status_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->status_, a.status_);
+ }
+
+ if (a.ci_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->ci_, a.ci_);
+ }
+
+ if (a.release_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->release_, a.release_);
+ }
+
+ if (a.publish_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->publish_, a.publish_);
+ }
+
+ if (a.deinit_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->deinit_, a.deinit_);
+ }
+
+ if (a.config_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->config_, a.config_);
+ }
+
+ if (a.test_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->test_, a.test_);
+ }
+
+ if (a.update_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->update_, a.update_);
+ }
+
+ if (a.clean_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->clean_, a.clean_);
+ }
+ }
+
+ ::bdep::cli::usage_para commands::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mCOMMANDS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1mhelp\033[0m [\033[4mtopic\033[0m] \033[1mbdep-help(1)\033[0m -- show help for a command or help topic" << ::std::endl;
+
+ os << "\033[1mnew\033[0m \033[1mbdep-new(1)\033[0m -- create and initialize new project" << ::std::endl;
+
+ os << "\033[1minit\033[0m \033[1mbdep-init(1)\033[0m -- initialize project in build" << ::std::endl
+ << " configurations" << ::std::endl;
+
+ os << "\033[1msync\033[0m \033[1mbdep-sync(1)\033[0m -- synchronize project and build" << ::std::endl
+ << " configurations" << ::std::endl;
+
+ os << "\033[1mfetch\033[0m \033[1mbdep-fetch(1)\033[0m -- fetch list of available project" << ::std::endl
+ << " dependencies" << ::std::endl;
+
+ os << "\033[1mstatus\033[0m \033[1mbdep-status(1)\033[0m -- print status of project and/or its" << ::std::endl
+ << " dependencies" << ::std::endl;
+
+ os << "\033[1mci\033[0m \033[1mbdep-ci(1)\033[0m -- submit project test request to CI" << ::std::endl
+ << " server" << ::std::endl;
+
+ os << "\033[1mrelease\033[0m \033[1mbdep-release(1)\033[0m -- manage project's version during" << ::std::endl
+ << " release" << ::std::endl;
+
+ os << "\033[1mpublish\033[0m \033[1mbdep-publish(1)\033[0m -- publish project to archive" << ::std::endl
+ << " repository" << ::std::endl;
+
+ os << "\033[1mdeinit\033[0m \033[1mbdep-deinit(1)\033[0m -- deinitialize project in build" << ::std::endl
+ << " configurations" << ::std::endl;
+
+ os << "\033[1mconfig\033[0m \033[1mbdep-config(1)\033[0m -- manage project's build" << ::std::endl
+ << " configurations" << ::std::endl;
+
+ os << "\033[1mtest\033[0m \033[1mbdep-test(1)\033[0m -- test project in build configurations" << ::std::endl;
+
+ os << "\033[1mupdate\033[0m \033[1mbdep-update(1)\033[0m -- update project in build" << ::std::endl
+ << " configurations" << ::std::endl;
+
+ os << "\033[1mclean\033[0m \033[1mbdep-clean(1)\033[0m -- clean project in build" << ::std::endl
+ << " configurations" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ return p;
+ }
+
+ struct _cli_commands_desc_type: ::bdep::cli::options
+ {
+ _cli_commands_desc_type ()
+ {
+ ::bdep::commands::fill (*this);
+ }
+ };
+
+ void commands::
+ fill (::bdep::cli::options& os)
+ {
+ // help
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("help", a, true, dv);
+ os.push_back (o);
+ }
+
+ // new
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("new", a, true, dv);
+ os.push_back (o);
+ }
+
+ // init
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("init", a, true, dv);
+ os.push_back (o);
+ }
+
+ // sync
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("sync", a, true, dv);
+ os.push_back (o);
+ }
+
+ // fetch
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("fetch", a, true, dv);
+ os.push_back (o);
+ }
+
+ // status
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("status", a, true, dv);
+ os.push_back (o);
+ }
+
+ // ci
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("ci", a, true, dv);
+ os.push_back (o);
+ }
+
+ // release
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("release", a, true, dv);
+ os.push_back (o);
+ }
+
+ // publish
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("publish", a, true, dv);
+ os.push_back (o);
+ }
+
+ // deinit
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("deinit", a, true, dv);
+ os.push_back (o);
+ }
+
+ // config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("config", a, true, dv);
+ os.push_back (o);
+ }
+
+ // test
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("test", a, true, dv);
+ os.push_back (o);
+ }
+
+ // update
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("update", a, true, dv);
+ os.push_back (o);
+ }
+
+ // clean
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("clean", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& commands::
+ description ()
+ {
+ static _cli_commands_desc_type _cli_commands_desc_;
+ return _cli_commands_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (commands&, ::bdep::cli::scanner&)>
+ _cli_commands_map;
+
+ static _cli_commands_map _cli_commands_map_;
+
+ struct _cli_commands_map_init
+ {
+ _cli_commands_map_init ()
+ {
+ _cli_commands_map_["help"] =
+ &::bdep::cli::thunk< commands, &commands::help_ >;
+ _cli_commands_map_["new"] =
+ &::bdep::cli::thunk< commands, &commands::new__ >;
+ _cli_commands_map_["init"] =
+ &::bdep::cli::thunk< commands, &commands::init_ >;
+ _cli_commands_map_["sync"] =
+ &::bdep::cli::thunk< commands, &commands::sync_ >;
+ _cli_commands_map_["fetch"] =
+ &::bdep::cli::thunk< commands, &commands::fetch_ >;
+ _cli_commands_map_["status"] =
+ &::bdep::cli::thunk< commands, &commands::status_ >;
+ _cli_commands_map_["ci"] =
+ &::bdep::cli::thunk< commands, &commands::ci_ >;
+ _cli_commands_map_["release"] =
+ &::bdep::cli::thunk< commands, &commands::release_ >;
+ _cli_commands_map_["publish"] =
+ &::bdep::cli::thunk< commands, &commands::publish_ >;
+ _cli_commands_map_["deinit"] =
+ &::bdep::cli::thunk< commands, &commands::deinit_ >;
+ _cli_commands_map_["config"] =
+ &::bdep::cli::thunk< commands, &commands::config_ >;
+ _cli_commands_map_["test"] =
+ &::bdep::cli::thunk< commands, &commands::test_ >;
+ _cli_commands_map_["update"] =
+ &::bdep::cli::thunk< commands, &commands::update_ >;
+ _cli_commands_map_["clean"] =
+ &::bdep::cli::thunk< commands, &commands::clean_ >;
+ }
+ };
+
+ static _cli_commands_map_init _cli_commands_map_init_;
+
+ bool commands::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_commands_map::const_iterator i (_cli_commands_map_.find (o));
+
+ if (i != _cli_commands_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool commands::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // topics
+ //
+
+ topics::
+ topics ()
+ : common_options_ (),
+ projects_configs_ (),
+ default_options_files_ (),
+ argument_grouping_ ()
+ {
+ }
+
+ bool topics::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool topics::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool topics::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool topics::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool topics::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void topics::
+ merge (const topics& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.common_options_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->common_options_, a.common_options_);
+ }
+
+ if (a.projects_configs_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->projects_configs_, a.projects_configs_);
+ }
+
+ if (a.default_options_files_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->default_options_files_, a.default_options_files_);
+ }
+
+ if (a.argument_grouping_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->argument_grouping_, a.argument_grouping_);
+ }
+ }
+
+ ::bdep::cli::usage_para topics::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mHELP TOPICS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1mcommon-options\033[0m \033[1mbdep-common-options(1)\033[0m -- details on common options" << ::std::endl;
+
+ os << "\033[1mprojects-configs\033[0m \033[1mbdep-projects-configs(1)\033[0m -- specifying projects and" << ::std::endl
+ << " configurations" << ::std::endl;
+
+ os << "\033[1mdefault-options-files\033[0m \033[1mbdep-default-options-files(1)\033[0m -- specifying default" << ::std::endl
+ << " options" << ::std::endl;
+
+ os << "\033[1margument-grouping\033[0m \033[1mbdep-argument-grouping(1)\033[0m -- argument grouping" << ::std::endl
+ << " facility" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ return p;
+ }
+
+ struct _cli_topics_desc_type: ::bdep::cli::options
+ {
+ _cli_topics_desc_type ()
+ {
+ ::bdep::topics::fill (*this);
+ }
+ };
+
+ void topics::
+ fill (::bdep::cli::options& os)
+ {
+ // common-options
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("common-options", a, true, dv);
+ os.push_back (o);
+ }
+
+ // projects-configs
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("projects-configs", a, true, dv);
+ os.push_back (o);
+ }
+
+ // default-options-files
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("default-options-files", a, true, dv);
+ os.push_back (o);
+ }
+
+ // argument-grouping
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("argument-grouping", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& topics::
+ description ()
+ {
+ static _cli_topics_desc_type _cli_topics_desc_;
+ return _cli_topics_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (topics&, ::bdep::cli::scanner&)>
+ _cli_topics_map;
+
+ static _cli_topics_map _cli_topics_map_;
+
+ struct _cli_topics_map_init
+ {
+ _cli_topics_map_init ()
+ {
+ _cli_topics_map_["common-options"] =
+ &::bdep::cli::thunk< topics, &topics::common_options_ >;
+ _cli_topics_map_["projects-configs"] =
+ &::bdep::cli::thunk< topics, &topics::projects_configs_ >;
+ _cli_topics_map_["default-options-files"] =
+ &::bdep::cli::thunk< topics, &topics::default_options_files_ >;
+ _cli_topics_map_["argument-grouping"] =
+ &::bdep::cli::thunk< topics, &topics::argument_grouping_ >;
+ }
+ };
+
+ static _cli_topics_map_init _cli_topics_map_init_;
+
+ bool topics::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_topics_map::const_iterator i (_cli_topics_map_.find (o));
+
+ if (i != _cli_topics_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool topics::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // options
+ //
+
+ options::
+ options ()
+ : help_ (),
+ version_ ()
+ {
+ }
+
+ bool options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void options::
+ merge (const options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // common_options base
+ //
+ ::bdep::common_options::merge (a);
+
+ if (a.help_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->help_, a.help_);
+ }
+
+ if (a.version_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->version_, a.version_);
+ }
+ }
+
+ ::bdep::cli::usage_para options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ // common_options base
+ //
+ p = ::bdep::common_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_options_desc_type: ::bdep::cli::options
+ {
+ _cli_options_desc_type ()
+ {
+ ::bdep::options::fill (*this);
+ }
+ };
+
+ void options::
+ fill (::bdep::cli::options& os)
+ {
+ // common_options base
+ //
+ ::bdep::common_options::fill (os);
+
+ // --help
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--help", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --version
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--version", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& options::
+ description ()
+ {
+ static _cli_options_desc_type _cli_options_desc_;
+ return _cli_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (options&, ::bdep::cli::scanner&)>
+ _cli_options_map;
+
+ static _cli_options_map _cli_options_map_;
+
+ struct _cli_options_map_init
+ {
+ _cli_options_map_init ()
+ {
+ _cli_options_map_["--help"] =
+ &::bdep::cli::thunk< options, &options::help_ >;
+ _cli_options_map_["--version"] =
+ &::bdep::cli::thunk< options, &options::version_ >;
+ }
+ };
+
+ static _cli_options_map_init _cli_options_map_init_;
+
+ bool options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_options_map::const_iterator i (_cli_options_map_.find (o));
+
+ if (i != _cli_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // common_options base
+ //
+ if (::bdep::common_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep --help\033[0m" << ::std::endl
+ << "\033[1mbdep --version\033[0m" << ::std::endl
+ << "\033[1mbdep help\033[0m [\033[4mcommand\033[0m | \033[4mtopic\033[0m]" << ::std::endl
+ << "\033[1mbdep\033[0m [\033[4mcommon-options\033[0m] \033[4mcommand\033[0m [\033[4mcommand-options\033[0m] \033[4mcommand-args\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mbuild2\033[0m project dependency manager is used to manage the dependencies of a" << ::std::endl
+ << "project during development." << ::std::endl
+ << ::std::endl
+ << "For a detailed description of any command or help topic, use the \033[1mhelp\033[0m command" << ::std::endl
+ << "or see the corresponding man page (the man pages have the \033[1mbdep-\033[0m prefix, for" << ::std::endl
+ << "example \033[1mbdep-help(1)\033[0m). Note also that \033[4mcommand-options\033[0m and \033[4mcommand-args\033[0m can be" << ::std::endl
+ << "specified in any order and \033[4mcommon-options\033[0m can be specified as part of" << ::std::endl
+ << "\033[4mcommand-options\033[0m." << ::std::endl;
+
+ p = ::bdep::commands::print_usage (os, ::bdep::cli::usage_para::text);
+
+ p = ::bdep::topics::print_usage (os, p);
+
+ p = ::bdep::options::print_usage (os, p);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mEXIT STATUS\033[0m" << ::std::endl
+ << ::std::endl
+ << "Non-zero exit status is returned in case of an error." << ::std::endl
+ << ::std::endl
+ << "\033[1mENVIRONMENT\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mBDEP_DEF_OPT\033[0m environment variable is used to suppress loading of default" << ::std::endl
+ << "options files in nested \033[1mbdep\033[0m invocations. Its values are \033[1mfalse\033[0m or \033[1m0\033[0m to suppress" << ::std::endl
+ << "and \033[1mtrue\033[0m or \033[1m1\033[0m to load." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/bdep-options.hxx b/bdep/bdep-options.hxx
new file mode 100644
index 0000000..3d5d92d
--- /dev/null
+++ b/bdep/bdep-options.hxx
@@ -0,0 +1,485 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_BDEP_OPTIONS_HXX
+#define BDEP_BDEP_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/common-options.hxx>
+
+namespace bdep
+{
+ class commands
+ {
+ public:
+ commands ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const commands&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ help () const;
+
+ bool&
+ help ();
+
+ void
+ help (const bool&);
+
+ const bool&
+ new_ () const;
+
+ bool&
+ new_ ();
+
+ void
+ new_ (const bool&);
+
+ const bool&
+ init () const;
+
+ bool&
+ init ();
+
+ void
+ init (const bool&);
+
+ const bool&
+ sync () const;
+
+ bool&
+ sync ();
+
+ void
+ sync (const bool&);
+
+ const bool&
+ fetch () const;
+
+ bool&
+ fetch ();
+
+ void
+ fetch (const bool&);
+
+ const bool&
+ status () const;
+
+ bool&
+ status ();
+
+ void
+ status (const bool&);
+
+ const bool&
+ ci () const;
+
+ bool&
+ ci ();
+
+ void
+ ci (const bool&);
+
+ const bool&
+ release () const;
+
+ bool&
+ release ();
+
+ void
+ release (const bool&);
+
+ const bool&
+ publish () const;
+
+ bool&
+ publish ();
+
+ void
+ publish (const bool&);
+
+ const bool&
+ deinit () const;
+
+ bool&
+ deinit ();
+
+ void
+ deinit (const bool&);
+
+ const bool&
+ config () const;
+
+ bool&
+ config ();
+
+ void
+ config (const bool&);
+
+ const bool&
+ test () const;
+
+ bool&
+ test ();
+
+ void
+ test (const bool&);
+
+ const bool&
+ update () const;
+
+ bool&
+ update ();
+
+ void
+ update (const bool&);
+
+ const bool&
+ clean () const;
+
+ bool&
+ clean ();
+
+ void
+ clean (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_commands_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool help_;
+ bool new__;
+ bool init_;
+ bool sync_;
+ bool fetch_;
+ bool status_;
+ bool ci_;
+ bool release_;
+ bool publish_;
+ bool deinit_;
+ bool config_;
+ bool test_;
+ bool update_;
+ bool clean_;
+ };
+
+ class topics
+ {
+ public:
+ topics ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const topics&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ common_options () const;
+
+ bool&
+ common_options ();
+
+ void
+ common_options (const bool&);
+
+ const bool&
+ projects_configs () const;
+
+ bool&
+ projects_configs ();
+
+ void
+ projects_configs (const bool&);
+
+ const bool&
+ default_options_files () const;
+
+ bool&
+ default_options_files ();
+
+ void
+ default_options_files (const bool&);
+
+ const bool&
+ argument_grouping () const;
+
+ bool&
+ argument_grouping ();
+
+ void
+ argument_grouping (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_topics_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool common_options_;
+ bool projects_configs_;
+ bool default_options_files_;
+ bool argument_grouping_;
+ };
+
+ class options: public ::bdep::common_options
+ {
+ public:
+ options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ help () const;
+
+ bool&
+ help ();
+
+ void
+ help (const bool&);
+
+ const bool&
+ version () const;
+
+ bool&
+ version ();
+
+ void
+ version (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool help_;
+ bool version_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/bdep-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_BDEP_OPTIONS_HXX
diff --git a/bdep/bdep-options.ixx b/bdep/bdep-options.ixx
new file mode 100644
index 0000000..c046f4a
--- /dev/null
+++ b/bdep/bdep-options.ixx
@@ -0,0 +1,387 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // commands
+ //
+
+ inline const bool& commands::
+ help () const
+ {
+ return this->help_;
+ }
+
+ inline bool& commands::
+ help ()
+ {
+ return this->help_;
+ }
+
+ inline void commands::
+ help (const bool& x)
+ {
+ this->help_ = x;
+ }
+
+ inline const bool& commands::
+ new_ () const
+ {
+ return this->new__;
+ }
+
+ inline bool& commands::
+ new_ ()
+ {
+ return this->new__;
+ }
+
+ inline void commands::
+ new_ (const bool& x)
+ {
+ this->new__ = x;
+ }
+
+ inline const bool& commands::
+ init () const
+ {
+ return this->init_;
+ }
+
+ inline bool& commands::
+ init ()
+ {
+ return this->init_;
+ }
+
+ inline void commands::
+ init (const bool& x)
+ {
+ this->init_ = x;
+ }
+
+ inline const bool& commands::
+ sync () const
+ {
+ return this->sync_;
+ }
+
+ inline bool& commands::
+ sync ()
+ {
+ return this->sync_;
+ }
+
+ inline void commands::
+ sync (const bool& x)
+ {
+ this->sync_ = x;
+ }
+
+ inline const bool& commands::
+ fetch () const
+ {
+ return this->fetch_;
+ }
+
+ inline bool& commands::
+ fetch ()
+ {
+ return this->fetch_;
+ }
+
+ inline void commands::
+ fetch (const bool& x)
+ {
+ this->fetch_ = x;
+ }
+
+ inline const bool& commands::
+ status () const
+ {
+ return this->status_;
+ }
+
+ inline bool& commands::
+ status ()
+ {
+ return this->status_;
+ }
+
+ inline void commands::
+ status (const bool& x)
+ {
+ this->status_ = x;
+ }
+
+ inline const bool& commands::
+ ci () const
+ {
+ return this->ci_;
+ }
+
+ inline bool& commands::
+ ci ()
+ {
+ return this->ci_;
+ }
+
+ inline void commands::
+ ci (const bool& x)
+ {
+ this->ci_ = x;
+ }
+
+ inline const bool& commands::
+ release () const
+ {
+ return this->release_;
+ }
+
+ inline bool& commands::
+ release ()
+ {
+ return this->release_;
+ }
+
+ inline void commands::
+ release (const bool& x)
+ {
+ this->release_ = x;
+ }
+
+ inline const bool& commands::
+ publish () const
+ {
+ return this->publish_;
+ }
+
+ inline bool& commands::
+ publish ()
+ {
+ return this->publish_;
+ }
+
+ inline void commands::
+ publish (const bool& x)
+ {
+ this->publish_ = x;
+ }
+
+ inline const bool& commands::
+ deinit () const
+ {
+ return this->deinit_;
+ }
+
+ inline bool& commands::
+ deinit ()
+ {
+ return this->deinit_;
+ }
+
+ inline void commands::
+ deinit (const bool& x)
+ {
+ this->deinit_ = x;
+ }
+
+ inline const bool& commands::
+ config () const
+ {
+ return this->config_;
+ }
+
+ inline bool& commands::
+ config ()
+ {
+ return this->config_;
+ }
+
+ inline void commands::
+ config (const bool& x)
+ {
+ this->config_ = x;
+ }
+
+ inline const bool& commands::
+ test () const
+ {
+ return this->test_;
+ }
+
+ inline bool& commands::
+ test ()
+ {
+ return this->test_;
+ }
+
+ inline void commands::
+ test (const bool& x)
+ {
+ this->test_ = x;
+ }
+
+ inline const bool& commands::
+ update () const
+ {
+ return this->update_;
+ }
+
+ inline bool& commands::
+ update ()
+ {
+ return this->update_;
+ }
+
+ inline void commands::
+ update (const bool& x)
+ {
+ this->update_ = x;
+ }
+
+ inline const bool& commands::
+ clean () const
+ {
+ return this->clean_;
+ }
+
+ inline bool& commands::
+ clean ()
+ {
+ return this->clean_;
+ }
+
+ inline void commands::
+ clean (const bool& x)
+ {
+ this->clean_ = x;
+ }
+
+ // topics
+ //
+
+ inline const bool& topics::
+ common_options () const
+ {
+ return this->common_options_;
+ }
+
+ inline bool& topics::
+ common_options ()
+ {
+ return this->common_options_;
+ }
+
+ inline void topics::
+ common_options (const bool& x)
+ {
+ this->common_options_ = x;
+ }
+
+ inline const bool& topics::
+ projects_configs () const
+ {
+ return this->projects_configs_;
+ }
+
+ inline bool& topics::
+ projects_configs ()
+ {
+ return this->projects_configs_;
+ }
+
+ inline void topics::
+ projects_configs (const bool& x)
+ {
+ this->projects_configs_ = x;
+ }
+
+ inline const bool& topics::
+ default_options_files () const
+ {
+ return this->default_options_files_;
+ }
+
+ inline bool& topics::
+ default_options_files ()
+ {
+ return this->default_options_files_;
+ }
+
+ inline void topics::
+ default_options_files (const bool& x)
+ {
+ this->default_options_files_ = x;
+ }
+
+ inline const bool& topics::
+ argument_grouping () const
+ {
+ return this->argument_grouping_;
+ }
+
+ inline bool& topics::
+ argument_grouping ()
+ {
+ return this->argument_grouping_;
+ }
+
+ inline void topics::
+ argument_grouping (const bool& x)
+ {
+ this->argument_grouping_ = x;
+ }
+
+ // options
+ //
+
+ inline const bool& options::
+ help () const
+ {
+ return this->help_;
+ }
+
+ inline bool& options::
+ help ()
+ {
+ return this->help_;
+ }
+
+ inline void options::
+ help (const bool& x)
+ {
+ this->help_ = x;
+ }
+
+ inline const bool& options::
+ version () const
+ {
+ return this->version_;
+ }
+
+ inline bool& options::
+ version ()
+ {
+ return this->version_;
+ }
+
+ inline void options::
+ version (const bool& x)
+ {
+ this->version_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/ci-options.cxx b/bdep/ci-options.cxx
new file mode 100644
index 0000000..582f327
--- /dev/null
+++ b/bdep/ci-options.cxx
@@ -0,0 +1,1231 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+#include <bdep/ci-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/ci-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_ci_options
+ //
+
+ cmd_ci_options::
+ cmd_ci_options ()
+ : yes_ (),
+ interactive_ (),
+ interactive_specified_ (false),
+ server_ (),
+ server_specified_ (false),
+ repository_ (),
+ repository_specified_ (false),
+ override_ (),
+ override_specified_ (false),
+ overrides_file_ (),
+ overrides_file_specified_ (false),
+ builds_ (),
+ builds_specified_ (false),
+ build_config_ (),
+ build_config_specified_ (false),
+ target_config_ (),
+ target_config_specified_ (false),
+ package_config_ (),
+ package_config_specified_ (false),
+ build_email_ (),
+ build_email_specified_ (false),
+ overrides_ (),
+ overrides_specified_ (false),
+ simulate_ (),
+ simulate_specified_ (false),
+ forward_ ()
+ {
+ }
+
+ bool cmd_ci_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_ci_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_ci_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_ci_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_ci_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_ci_options::
+ merge (const cmd_ci_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.yes_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->yes_, a.yes_);
+ }
+
+ if (a.interactive_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->interactive_, a.interactive_);
+ this->interactive_specified_ = true;
+ }
+
+ if (a.server_specified_)
+ {
+ ::bdep::cli::parser< url>::merge (
+ this->server_, a.server_);
+ this->server_specified_ = true;
+ }
+
+ if (a.repository_specified_)
+ {
+ ::bdep::cli::parser< url>::merge (
+ this->repository_, a.repository_);
+ this->repository_specified_ = true;
+ }
+
+ if (a.override_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->override_, a.override_);
+ this->override_specified_ = true;
+ }
+
+ if (a.overrides_file_specified_)
+ {
+ ::bdep::cli::parser< path>::merge (
+ this->overrides_file_, a.overrides_file_);
+ this->overrides_file_specified_ = true;
+ }
+
+ if (a.builds_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->builds_, a.builds_);
+ this->builds_specified_ = true;
+ }
+
+ if (a.build_config_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->build_config_, a.build_config_);
+ this->build_config_specified_ = true;
+ }
+
+ if (a.target_config_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->target_config_, a.target_config_);
+ this->target_config_specified_ = true;
+ }
+
+ if (a.package_config_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->package_config_, a.package_config_);
+ this->package_config_specified_ = true;
+ }
+
+ if (a.build_email_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->build_email_, a.build_email_);
+ this->build_email_specified_ = true;
+ }
+
+ if (a.overrides_specified_)
+ {
+ ::bdep::cli::parser< cmd_ci_override>::merge (
+ this->overrides_, a.overrides_);
+ this->overrides_specified_ = true;
+ }
+
+ if (a.simulate_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->simulate_, a.simulate_);
+ this->simulate_specified_ = true;
+ }
+
+ if (a.forward_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->forward_, a.forward_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_ci_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mCI OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--yes\033[0m|\033[1m-y\033[0m Don't prompt for confirmation before submitting." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--interactive\033[0m|\033[1m-i\033[0m \033[4mcf\033[0m[:\033[4mbp\033[0m] Test the package interactively in the specified build" << ::std::endl
+ << " configuration, pausing the execution at the specified" << ::std::endl
+ << " breakpoint. The build configuration is a target" << ::std::endl
+ << " configuration (\033[4mtc\033[0m), optionally for a specific package" << ::std::endl
+ << " configuration (\033[4mpc\033[0m) and/or for a specific target (\033[4mtg\033[0m):" << ::std::endl
+ << ::std::endl
+ << " \033[4mcf\033[0m = [\033[4mpc\033[0m\033[1m/\033[0m]\033[4mtc\033[0m | \033[4mpc\033[0m\033[1m/\033[0m\033[4mtc\033[0m\033[1m/\033[0m\033[4mtg\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << " Refer to the \033[1m--build-config\033[0m option for details on the" << ::std::endl
+ << " build configuration component semantics. Note that" << ::std::endl
+ << " for interactive testing they should identify a single" << ::std::endl
+ << " build configuration. Failed that, the test request" << ::std::endl
+ << " will be aborted." << ::std::endl
+ << ::std::endl
+ << " Valid breakpoint values are \033[1mnone\033[0m (don't stop), \033[1merror\033[0m" << ::std::endl
+ << " (stop after first error), \033[1mwarning\033[0m (stop after first" << ::std::endl
+ << " warning), as well as the CI service-specific step ids" << ::std::endl
+ << " in which case the execution stops before performing" << ::std::endl
+ << " the specified step (see \033[1mbbot\033[0m worker step ids" << ::std::endl
+ << " (bbot#arch-worker)). If no breakpoint is specified," << ::std::endl
+ << " then \033[1merror\033[0m is assumed." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--server\033[0m \033[4murl\033[0m CI server to submit the request to." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--repository\033[0m \033[4murl\033[0m Remote repository URL for the project." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--override\033[0m \033[4mname\033[0m:\033[4mvalue\033[0m Package manifest value override. Repeat this option" << ::std::endl
+ << " to override multiple values." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--overrides-file\033[0m \033[4mfile\033[0m Read manifest value overrides from the specified" << ::std::endl
+ << " manifest fragment file. Repeat this option to specify" << ::std::endl
+ << " multiple override files." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--builds\033[0m [\033[4mpc\033[0m/]\033[4mclass-expr\033[0m Shortcut for the following option:" << ::std::endl
+ << ::std::endl
+ << " \033[1m--override \033[0m[\033[4mpc\033[0m\033[1m-\033[0m]\033[1mbuilds:\033[0m\033[4mclass-expr\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << " Repeat this option to specify multiple build target" << ::std::endl
+ << " configuration classes." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--build-config\033[0m \033[4mpc\033[0m/\033[4mtc\033[0m[/\033[4mtg\033[0m] Shortcut for the following options sequence:" << ::std::endl
+ << ::std::endl
+ << " [\033[1m--override \033[0m\033[4mpc\033[0m\033[1m-builds:all\033[0m\033[0m]" << ::std::endl
+ << " \033[1m--override \033[0m\033[4mpc\033[0m\033[1m-build-include:\033[0m\033[4mtc\033[0m[\033[1m/\033[0m\033[4mtg\033[0m]\033[0m" << ::std::endl
+ << " \033[1m--override \033[0m\033[4mpc\033[0m\033[1m-build-exclude:**\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << " The first override is omitted from the above sequence" << ::std::endl
+ << " if the \033[4mpc\033[0m\033[1m-builds\033[0m\033[0m override is specified on the command" << ::std::endl
+ << " line." << ::std::endl
+ << ::std::endl
+ << " Repeat this option to specify multiple build" << ::std::endl
+ << " configurations." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--target-config\033[0m \033[4mtc\033[0m[/\033[4mtg\033[0m] Shortcut for the following options sequence:" << ::std::endl
+ << ::std::endl
+ << " [\033[1m--override builds:all\033[0m\033[0m]" << ::std::endl
+ << " \033[1m--override build-include:\033[0m\033[4mtc\033[0m[\033[1m/\033[0m\033[4mtg\033[0m]\033[0m" << ::std::endl
+ << " \033[1m--override build-exclude:**\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << " The first override is omitted from the above sequence" << ::std::endl
+ << " if the \033[1mbuilds\033[0m override is specified on the command" << ::std::endl
+ << " line." << ::std::endl
+ << ::std::endl
+ << " Repeat this option to specify multiple build target" << ::std::endl
+ << " configurations." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--package-config\033[0m \033[4mpc\033[0m Shortcut for the following options sequence:" << ::std::endl
+ << ::std::endl
+ << " \033[1m--override \033[0m\033[4mpc\033[0m\033[1m-builds:\033[0m...\033[0m" << ::std::endl
+ << " \033[1m--override \033[0m\033[4mpc\033[0m\033[1m-build-include:\033[0m...\033[0m" << ::std::endl
+ << " \033[1m--override \033[0m\033[4mpc\033[0m\033[1m-build-exclude:\033[0m...\033[0m" << ::std::endl
+ << ::std::endl
+ << " Where the override values are the build constraints" << ::std::endl
+ << " for the specified build package configuration from" << ::std::endl
+ << " the package manifest." << ::std::endl
+ << ::std::endl
+ << " Repeat this option to specify multiple build package" << ::std::endl
+ << " configurations." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--build-email\033[0m \033[4memail\033[0m Shortcut for the following option:" << ::std::endl
+ << ::std::endl
+ << " \033[1m--override build-email:\033[0m\033[4memail\033[0m\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--simulate\033[0m \033[4moutcome\033[0m Simulate the specified outcome of the CI process" << ::std::endl
+ << " without actually performing any externally visible" << ::std::endl
+ << " actions (such as testing the packages or publishing" << ::std::endl
+ << " the result). The commonly used outcome value is" << ::std::endl
+ << " \033[1msuccess\033[0m. For other recognized outcomes refer to the" << ::std::endl
+ << " CI service documentation." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--forward\033[0m Use the forwarded configuration for each package" << ::std::endl
+ << " instead of the default configuration." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_ci_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_ci_options_desc_type ()
+ {
+ ::bdep::cmd_ci_options::fill (*this);
+ }
+ };
+
+ void cmd_ci_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --yes
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-y");
+ std::string dv;
+ ::bdep::cli::option o ("--yes", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --interactive
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-i");
+ std::string dv;
+ ::bdep::cli::option o ("--interactive", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --server
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--server", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --repository
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--repository", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --override
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--override", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --overrides-file
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--overrides-file", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --builds
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--builds", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --build-config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--build-config", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --target-config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--target-config", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --package-config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--package-config", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --build-email
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--build-email", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --overrides
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("--override");
+ a.push_back ("--overrides-file");
+ a.push_back ("--builds");
+ a.push_back ("--build-email");
+ std::string dv;
+ ::bdep::cli::option o ("--overrides", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --simulate
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--simulate", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --forward
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--forward", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_ci_options::
+ description ()
+ {
+ static _cli_cmd_ci_options_desc_type _cli_cmd_ci_options_desc_;
+ return _cli_cmd_ci_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_ci_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_ci_options_map;
+
+ static _cli_cmd_ci_options_map _cli_cmd_ci_options_map_;
+
+ struct _cli_cmd_ci_options_map_init
+ {
+ _cli_cmd_ci_options_map_init ()
+ {
+ _cli_cmd_ci_options_map_["--yes"] =
+ &::bdep::cli::thunk< cmd_ci_options, &cmd_ci_options::yes_ >;
+ _cli_cmd_ci_options_map_["-y"] =
+ &::bdep::cli::thunk< cmd_ci_options, &cmd_ci_options::yes_ >;
+ _cli_cmd_ci_options_map_["--interactive"] =
+ &::bdep::cli::thunk< cmd_ci_options, string, &cmd_ci_options::interactive_,
+ &cmd_ci_options::interactive_specified_ >;
+ _cli_cmd_ci_options_map_["-i"] =
+ &::bdep::cli::thunk< cmd_ci_options, string, &cmd_ci_options::interactive_,
+ &cmd_ci_options::interactive_specified_ >;
+ _cli_cmd_ci_options_map_["--server"] =
+ &::bdep::cli::thunk< cmd_ci_options, url, &cmd_ci_options::server_,
+ &cmd_ci_options::server_specified_ >;
+ _cli_cmd_ci_options_map_["--repository"] =
+ &::bdep::cli::thunk< cmd_ci_options, url, &cmd_ci_options::repository_,
+ &cmd_ci_options::repository_specified_ >;
+ _cli_cmd_ci_options_map_["--override"] =
+ &::bdep::cli::thunk< cmd_ci_options, strings, &cmd_ci_options::override_,
+ &cmd_ci_options::override_specified_ >;
+ _cli_cmd_ci_options_map_["--overrides-file"] =
+ &::bdep::cli::thunk< cmd_ci_options, path, &cmd_ci_options::overrides_file_,
+ &cmd_ci_options::overrides_file_specified_ >;
+ _cli_cmd_ci_options_map_["--builds"] =
+ &::bdep::cli::thunk< cmd_ci_options, strings, &cmd_ci_options::builds_,
+ &cmd_ci_options::builds_specified_ >;
+ _cli_cmd_ci_options_map_["--build-config"] =
+ &::bdep::cli::thunk< cmd_ci_options, strings, &cmd_ci_options::build_config_,
+ &cmd_ci_options::build_config_specified_ >;
+ _cli_cmd_ci_options_map_["--target-config"] =
+ &::bdep::cli::thunk< cmd_ci_options, strings, &cmd_ci_options::target_config_,
+ &cmd_ci_options::target_config_specified_ >;
+ _cli_cmd_ci_options_map_["--package-config"] =
+ &::bdep::cli::thunk< cmd_ci_options, strings, &cmd_ci_options::package_config_,
+ &cmd_ci_options::package_config_specified_ >;
+ _cli_cmd_ci_options_map_["--build-email"] =
+ &::bdep::cli::thunk< cmd_ci_options, string, &cmd_ci_options::build_email_,
+ &cmd_ci_options::build_email_specified_ >;
+ _cli_cmd_ci_options_map_["--overrides"] =
+ &::bdep::cli::thunk< cmd_ci_options, cmd_ci_override, &cmd_ci_options::overrides_,
+ &cmd_ci_options::overrides_specified_ >;
+ _cli_cmd_ci_options_map_["--override"] =
+ &::bdep::cli::thunk< cmd_ci_options, cmd_ci_override, &cmd_ci_options::overrides_,
+ &cmd_ci_options::overrides_specified_ >;
+ _cli_cmd_ci_options_map_["--overrides-file"] =
+ &::bdep::cli::thunk< cmd_ci_options, cmd_ci_override, &cmd_ci_options::overrides_,
+ &cmd_ci_options::overrides_specified_ >;
+ _cli_cmd_ci_options_map_["--builds"] =
+ &::bdep::cli::thunk< cmd_ci_options, cmd_ci_override, &cmd_ci_options::overrides_,
+ &cmd_ci_options::overrides_specified_ >;
+ _cli_cmd_ci_options_map_["--build-email"] =
+ &::bdep::cli::thunk< cmd_ci_options, cmd_ci_override, &cmd_ci_options::overrides_,
+ &cmd_ci_options::overrides_specified_ >;
+ _cli_cmd_ci_options_map_["--simulate"] =
+ &::bdep::cli::thunk< cmd_ci_options, string, &cmd_ci_options::simulate_,
+ &cmd_ci_options::simulate_specified_ >;
+ _cli_cmd_ci_options_map_["--forward"] =
+ &::bdep::cli::thunk< cmd_ci_options, &cmd_ci_options::forward_ >;
+ }
+ };
+
+ static _cli_cmd_ci_options_map_init _cli_cmd_ci_options_map_init_;
+
+ bool cmd_ci_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_ci_options_map::const_iterator i (_cli_cmd_ci_options_map_.find (o));
+
+ if (i != _cli_cmd_ci_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_ci_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_ci_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep ci\033[0m [\033[4moptions\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mpkg-spec\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m | \033[1m--forward\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mci\033[0m command submits the project packages test request to a CI server." << ::std::endl
+ << ::std::endl
+ << "If no project or package directory is specified, then the current working" << ::std::endl
+ << "directory is assumed. If no configuration is specified, then the default" << ::std::endl
+ << "configurations are used. If the specified directory is a project directory," << ::std::endl
+ << "then all the packages initialized in the configurations are submitted, unless" << ::std::endl
+ << "the \033[1m--forward\033[0m option is specified (see below). See \033[1mbdep-projects-configs(1)\033[0m for" << ::std::endl
+ << "details on specifying projects and configurations." << ::std::endl
+ << ::std::endl
+ << "A CI request consists of the specified packages and their versions as well as" << ::std::endl
+ << "the project's remote version control repository URL corresponding to the" << ::std::endl
+ << "current (local) state of the project. The CI server should be able to fetch" << ::std::endl
+ << "these package versions from this repository as well as any dependencies from" << ::std::endl
+ << "this repository or its prerequisite/complement repositories, according to each" << ::std::endl
+ << "package's \033[1mrepositories.manifest\033[0m." << ::std::endl
+ << ::std::endl
+ << "If the CI server is not explicitly specified with the \033[1m--server\033[0m option, the" << ::std::endl
+ << "request is submitted to \033[1mci.cppget.org\033[0m by default." << ::std::endl
+ << ::std::endl
+ << "Unless the remote repository URL is specified with the \033[1m--repository\033[0m option, it" << ::std::endl
+ << "will be automatically derived from the version control's \"remote\" URL. In case" << ::std::endl
+ << "of \033[1mgit(1)\033[0m, it will be based on the \033[1mremote.origin.url\033[0m configuration value unless" << ::std::endl
+ << "overridden with \033[1mremote.origin.build2Url\033[0m. The repository URL is then adjusted to" << ::std::endl
+ << "corresponding to the current (local) state of the project. In case of \033[1mgit(1)\033[0m," << ::std::endl
+ << "the current branch and commit id are added as the repository URL fragment (see" << ::std::endl
+ << "\033[1mbpkg-repository-types(1)\033[0m for details)." << ::std::endl
+ << ::std::endl
+ << "Some package manifest values can be overridden as part of the CI request" << ::std::endl
+ << "submission using the \033[1m--override\033[0m and \033[1m--overrides-file\033[0m options as well as their" << ::std::endl
+ << "\033[1m--builds\033[0m, \033[1m--build-config\033[0m, \033[1m--target-config\033[0m, \033[1m--package-config\033[0m, and \033[1m--build-email\033[0m" << ::std::endl
+ << "shortcuts. This is primarily useful for specifying alternative build" << ::std::endl
+ << "configurations and/or build notification emails. For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep ci --builds gcc" << ::std::endl
+ << "$ bdep ci --builds network/gcc" << ::std::endl
+ << "$ bdep ci --target-config 'linux*-gcc*'" << ::std::endl
+ << "$ bdep ci --package-config network" << ::std::endl
+ << "$ bdep ci --build-config 'network/linux*-gcc*'" << ::std::endl
+ << ::std::endl
+ << "$ bdep ci --override \\" << ::std::endl
+ << " 'default-build-config: config.foo.cache=true config.foo.buffer=16'" << ::std::endl
+ << ::std::endl
+ << "$ bdep ci --override 'mytest-build-config: config.foo.cache=true' \\" << ::std::endl
+ << " --package-config mytest" << ::std::endl
+ << ::std::endl
+ << "$ bdep ci --override 'build-auxiliary: *-postgresql_16'" << ::std::endl
+ << ::std::endl
+ << "Manifest overrides other than [\033[1m*-\033[0m]\033[1mbuild-auxiliary\033[0m[\033[1m-*\033[0m]\033[0m override the entire value" << ::std::endl
+ << "group that they belong to. The [\033[1m*-\033[0m]\033[1mbuild-auxiliary\033[0m[\033[1m-*\033[0m]\033[0m values only override the" << ::std::endl
+ << "matching values, which are expected to already be present in the package" << ::std::endl
+ << "manifest. Currently, the following value groups/values can be overridden. The" << ::std::endl
+ << "\033[1mbuild-*email\033[0m group is overridden by default as if by specifying an empty build" << ::std::endl
+ << "email." << ::std::endl
+ << ::std::endl
+ << "build-email build-{warning,error}-email" << ::std::endl
+ << "builds build-{include,exclude}" << ::std::endl
+ << "build-bot" << ::std::endl
+ << "*-builds *-build-{include,exclude}" << ::std::endl
+ << "*-build-bot" << ::std::endl
+ << "*-build-config" << ::std::endl
+ << "*-build-email *-build-{warning,error}-email" << ::std::endl
+ << ::std::endl
+ << "[*-]build-auxiliary[-*]" << ::std::endl
+ << ::std::endl
+ << "For the package configuration-specific build constraint, email, auxiliary, and" << ::std::endl
+ << "custom bot public key overrides, the corresponding configuration must exist in" << ::std::endl
+ << "the package manifest. In contrast, the package configuration override" << ::std::endl
+ << "(\033[1m*-build-config\033[0m) adds a new configuration if it doesn't exist and updates the" << ::std::endl
+ << "arguments of the existing configuration otherwise. In the former case, all the" << ::std::endl
+ << "potential build constraint, email, auxiliary, and custom bot public key" << ::std::endl
+ << "overrides for such a newly added configuration must follow the corresponding" << ::std::endl
+ << "\033[1m*-build-config\033[0m override." << ::std::endl
+ << ::std::endl
+ << "Note that the build constraints group values (both common and build package" << ::std::endl
+ << "configuration-specific) are overridden hierarchically so that the" << ::std::endl
+ << "[\033[1m*-\033[0m]\033[1mbuild-\033[0m{\033[1minclude\033[0m,\033[1mexclude\033[0m}\033[0m overrides don't affect the respective [\033[1m*-\033[0m]\033[1mbuilds\033[0m\033[0m" << ::std::endl
+ << "values." << ::std::endl
+ << ::std::endl
+ << "Note also that the common and build package configuration-specific build" << ::std::endl
+ << "constraints group value overrides are mutually exclusive. If the common build" << ::std::endl
+ << "constraints are overridden, then all the configuration-specific constraints are" << ::std::endl
+ << "removed. Otherwise, if any configuration-specific constraints are overridden," << ::std::endl
+ << "then for the remaining configurations the build constraints are reset to" << ::std::endl
+ << "\033[1mbuilds: none\033[0m." << ::std::endl
+ << ::std::endl
+ << "Similar to the build constraints groups, the common and build package" << ::std::endl
+ << "configuration-specific custom bot public key value overrides are mutually" << ::std::endl
+ << "exclusive. If the common build custom bot public keys are overridden, then all" << ::std::endl
+ << "the configuration-specific custom bot public keys are removed. Otherwise, if" << ::std::endl
+ << "any configuration-specific custom bot public keys are overridden, then for the" << ::std::endl
+ << "remaining configurations the custom bot public keys are left unchanged." << ::std::endl
+ << ::std::endl
+ << "Similar to the above, the common and build package configuration-specific build" << ::std::endl
+ << "emails group value overrides are mutually exclusive. If the common build emails" << ::std::endl
+ << "are overridden, then all the configuration-specific emails are removed." << ::std::endl
+ << "Otherwise, if any configuration-specific emails are overridden, then for the" << ::std::endl
+ << "remaining configurations the build emails are reset to the empty values and the" << ::std::endl
+ << "build warning and error emails are removed (which effectively disables email" << ::std::endl
+ << "notifications for such configurations)." << ::std::endl
+ << ::std::endl
+ << "If supported by the CI service, a package can be tested interactively in a" << ::std::endl
+ << "specific build configuration using the \033[1m--interactive\033[0m|\033[1m-i\033[0m\033[0m option. In this mode" << ::std::endl
+ << "the CI service provides the login information for the execution environment and" << ::std::endl
+ << "pauses the testing at the specified breakpoint." << ::std::endl
+ << ::std::endl
+ << "While the exact interpretation of the CI request depends on the specific" << ::std::endl
+ << "service, normally, the CI server will respond with a reference that can be used" << ::std::endl
+ << "to query the results. See Package CI (brep#ci) for details on the CI request" << ::std::endl
+ << "handling." << ::std::endl
+ << ::std::endl
+ << "If the \033[1m--forward\033[0m option is specified then the forwarded configurations are used" << ::std::endl
+ << "instead of the default configurations. In particular, this means that in this" << ::std::endl
+ << "mode the project doesn't need to be initialized and all that's required is for" << ::std::endl
+ << "package's source directories to be configured to forward to an out of source" << ::std::endl
+ << "build configuration (see \033[1mb(1)\033[0m for details on forwarded configurations). This," << ::std::endl
+ << "for example, can be used to submit packages that don't use the standard" << ::std::endl
+ << "version." << ::std::endl;
+
+ p = ::bdep::cmd_ci_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mci\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-ci.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mci\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/ci-options.hxx b/bdep/ci-options.hxx
new file mode 100644
index 0000000..da7f078
--- /dev/null
+++ b/bdep/ci-options.hxx
@@ -0,0 +1,345 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_CI_OPTIONS_HXX
+#define BDEP_CI_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+#include <bdep/ci-types.hxx>
+
+namespace bdep
+{
+ class cmd_ci_options: public ::bdep::project_options
+ {
+ public:
+ cmd_ci_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_ci_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ yes () const;
+
+ bool&
+ yes ();
+
+ void
+ yes (const bool&);
+
+ const string&
+ interactive () const;
+
+ string&
+ interactive ();
+
+ void
+ interactive (const string&);
+
+ bool
+ interactive_specified () const;
+
+ void
+ interactive_specified (bool);
+
+ const url&
+ server () const;
+
+ url&
+ server ();
+
+ void
+ server (const url&);
+
+ bool
+ server_specified () const;
+
+ void
+ server_specified (bool);
+
+ const url&
+ repository () const;
+
+ url&
+ repository ();
+
+ void
+ repository (const url&);
+
+ bool
+ repository_specified () const;
+
+ void
+ repository_specified (bool);
+
+ const strings&
+ override () const;
+
+ strings&
+ override ();
+
+ void
+ override (const strings&);
+
+ bool
+ override_specified () const;
+
+ void
+ override_specified (bool);
+
+ const path&
+ overrides_file () const;
+
+ path&
+ overrides_file ();
+
+ void
+ overrides_file (const path&);
+
+ bool
+ overrides_file_specified () const;
+
+ void
+ overrides_file_specified (bool);
+
+ const strings&
+ builds () const;
+
+ strings&
+ builds ();
+
+ void
+ builds (const strings&);
+
+ bool
+ builds_specified () const;
+
+ void
+ builds_specified (bool);
+
+ const strings&
+ build_config () const;
+
+ strings&
+ build_config ();
+
+ void
+ build_config (const strings&);
+
+ bool
+ build_config_specified () const;
+
+ void
+ build_config_specified (bool);
+
+ const strings&
+ target_config () const;
+
+ strings&
+ target_config ();
+
+ void
+ target_config (const strings&);
+
+ bool
+ target_config_specified () const;
+
+ void
+ target_config_specified (bool);
+
+ const strings&
+ package_config () const;
+
+ strings&
+ package_config ();
+
+ void
+ package_config (const strings&);
+
+ bool
+ package_config_specified () const;
+
+ void
+ package_config_specified (bool);
+
+ const string&
+ build_email () const;
+
+ string&
+ build_email ();
+
+ void
+ build_email (const string&);
+
+ bool
+ build_email_specified () const;
+
+ void
+ build_email_specified (bool);
+
+ const cmd_ci_override&
+ overrides () const;
+
+ cmd_ci_override&
+ overrides ();
+
+ void
+ overrides (const cmd_ci_override&);
+
+ bool
+ overrides_specified () const;
+
+ void
+ overrides_specified (bool);
+
+ const string&
+ simulate () const;
+
+ string&
+ simulate ();
+
+ void
+ simulate (const string&);
+
+ bool
+ simulate_specified () const;
+
+ void
+ simulate_specified (bool);
+
+ const bool&
+ forward () const;
+
+ bool&
+ forward ();
+
+ void
+ forward (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_ci_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool yes_;
+ string interactive_;
+ bool interactive_specified_;
+ url server_;
+ bool server_specified_;
+ url repository_;
+ bool repository_specified_;
+ strings override_;
+ bool override_specified_;
+ path overrides_file_;
+ bool overrides_file_specified_;
+ strings builds_;
+ bool builds_specified_;
+ strings build_config_;
+ bool build_config_specified_;
+ strings target_config_;
+ bool target_config_specified_;
+ strings package_config_;
+ bool package_config_specified_;
+ string build_email_;
+ bool build_email_specified_;
+ cmd_ci_override overrides_;
+ bool overrides_specified_;
+ string simulate_;
+ bool simulate_specified_;
+ bool forward_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_ci_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/ci-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_CI_OPTIONS_HXX
diff --git a/bdep/ci-options.ixx b/bdep/ci-options.ixx
new file mode 100644
index 0000000..2d5d3bd
--- /dev/null
+++ b/bdep/ci-options.ixx
@@ -0,0 +1,417 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_ci_options
+ //
+
+ inline const bool& cmd_ci_options::
+ yes () const
+ {
+ return this->yes_;
+ }
+
+ inline bool& cmd_ci_options::
+ yes ()
+ {
+ return this->yes_;
+ }
+
+ inline void cmd_ci_options::
+ yes (const bool& x)
+ {
+ this->yes_ = x;
+ }
+
+ inline const string& cmd_ci_options::
+ interactive () const
+ {
+ return this->interactive_;
+ }
+
+ inline string& cmd_ci_options::
+ interactive ()
+ {
+ return this->interactive_;
+ }
+
+ inline void cmd_ci_options::
+ interactive (const string& x)
+ {
+ this->interactive_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ interactive_specified () const
+ {
+ return this->interactive_specified_;
+ }
+
+ inline void cmd_ci_options::
+ interactive_specified (bool x)
+ {
+ this->interactive_specified_ = x;
+ }
+
+ inline const url& cmd_ci_options::
+ server () const
+ {
+ return this->server_;
+ }
+
+ inline url& cmd_ci_options::
+ server ()
+ {
+ return this->server_;
+ }
+
+ inline void cmd_ci_options::
+ server (const url& x)
+ {
+ this->server_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ server_specified () const
+ {
+ return this->server_specified_;
+ }
+
+ inline void cmd_ci_options::
+ server_specified (bool x)
+ {
+ this->server_specified_ = x;
+ }
+
+ inline const url& cmd_ci_options::
+ repository () const
+ {
+ return this->repository_;
+ }
+
+ inline url& cmd_ci_options::
+ repository ()
+ {
+ return this->repository_;
+ }
+
+ inline void cmd_ci_options::
+ repository (const url& x)
+ {
+ this->repository_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ repository_specified () const
+ {
+ return this->repository_specified_;
+ }
+
+ inline void cmd_ci_options::
+ repository_specified (bool x)
+ {
+ this->repository_specified_ = x;
+ }
+
+ inline const strings& cmd_ci_options::
+ override () const
+ {
+ return this->override_;
+ }
+
+ inline strings& cmd_ci_options::
+ override ()
+ {
+ return this->override_;
+ }
+
+ inline void cmd_ci_options::
+ override (const strings& x)
+ {
+ this->override_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ override_specified () const
+ {
+ return this->override_specified_;
+ }
+
+ inline void cmd_ci_options::
+ override_specified (bool x)
+ {
+ this->override_specified_ = x;
+ }
+
+ inline const path& cmd_ci_options::
+ overrides_file () const
+ {
+ return this->overrides_file_;
+ }
+
+ inline path& cmd_ci_options::
+ overrides_file ()
+ {
+ return this->overrides_file_;
+ }
+
+ inline void cmd_ci_options::
+ overrides_file (const path& x)
+ {
+ this->overrides_file_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ overrides_file_specified () const
+ {
+ return this->overrides_file_specified_;
+ }
+
+ inline void cmd_ci_options::
+ overrides_file_specified (bool x)
+ {
+ this->overrides_file_specified_ = x;
+ }
+
+ inline const strings& cmd_ci_options::
+ builds () const
+ {
+ return this->builds_;
+ }
+
+ inline strings& cmd_ci_options::
+ builds ()
+ {
+ return this->builds_;
+ }
+
+ inline void cmd_ci_options::
+ builds (const strings& x)
+ {
+ this->builds_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ builds_specified () const
+ {
+ return this->builds_specified_;
+ }
+
+ inline void cmd_ci_options::
+ builds_specified (bool x)
+ {
+ this->builds_specified_ = x;
+ }
+
+ inline const strings& cmd_ci_options::
+ build_config () const
+ {
+ return this->build_config_;
+ }
+
+ inline strings& cmd_ci_options::
+ build_config ()
+ {
+ return this->build_config_;
+ }
+
+ inline void cmd_ci_options::
+ build_config (const strings& x)
+ {
+ this->build_config_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ build_config_specified () const
+ {
+ return this->build_config_specified_;
+ }
+
+ inline void cmd_ci_options::
+ build_config_specified (bool x)
+ {
+ this->build_config_specified_ = x;
+ }
+
+ inline const strings& cmd_ci_options::
+ target_config () const
+ {
+ return this->target_config_;
+ }
+
+ inline strings& cmd_ci_options::
+ target_config ()
+ {
+ return this->target_config_;
+ }
+
+ inline void cmd_ci_options::
+ target_config (const strings& x)
+ {
+ this->target_config_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ target_config_specified () const
+ {
+ return this->target_config_specified_;
+ }
+
+ inline void cmd_ci_options::
+ target_config_specified (bool x)
+ {
+ this->target_config_specified_ = x;
+ }
+
+ inline const strings& cmd_ci_options::
+ package_config () const
+ {
+ return this->package_config_;
+ }
+
+ inline strings& cmd_ci_options::
+ package_config ()
+ {
+ return this->package_config_;
+ }
+
+ inline void cmd_ci_options::
+ package_config (const strings& x)
+ {
+ this->package_config_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ package_config_specified () const
+ {
+ return this->package_config_specified_;
+ }
+
+ inline void cmd_ci_options::
+ package_config_specified (bool x)
+ {
+ this->package_config_specified_ = x;
+ }
+
+ inline const string& cmd_ci_options::
+ build_email () const
+ {
+ return this->build_email_;
+ }
+
+ inline string& cmd_ci_options::
+ build_email ()
+ {
+ return this->build_email_;
+ }
+
+ inline void cmd_ci_options::
+ build_email (const string& x)
+ {
+ this->build_email_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ build_email_specified () const
+ {
+ return this->build_email_specified_;
+ }
+
+ inline void cmd_ci_options::
+ build_email_specified (bool x)
+ {
+ this->build_email_specified_ = x;
+ }
+
+ inline const cmd_ci_override& cmd_ci_options::
+ overrides () const
+ {
+ return this->overrides_;
+ }
+
+ inline cmd_ci_override& cmd_ci_options::
+ overrides ()
+ {
+ return this->overrides_;
+ }
+
+ inline void cmd_ci_options::
+ overrides (const cmd_ci_override& x)
+ {
+ this->overrides_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ overrides_specified () const
+ {
+ return this->overrides_specified_;
+ }
+
+ inline void cmd_ci_options::
+ overrides_specified (bool x)
+ {
+ this->overrides_specified_ = x;
+ }
+
+ inline const string& cmd_ci_options::
+ simulate () const
+ {
+ return this->simulate_;
+ }
+
+ inline string& cmd_ci_options::
+ simulate ()
+ {
+ return this->simulate_;
+ }
+
+ inline void cmd_ci_options::
+ simulate (const string& x)
+ {
+ this->simulate_ = x;
+ }
+
+ inline bool cmd_ci_options::
+ simulate_specified () const
+ {
+ return this->simulate_specified_;
+ }
+
+ inline void cmd_ci_options::
+ simulate_specified (bool x)
+ {
+ this->simulate_specified_ = x;
+ }
+
+ inline const bool& cmd_ci_options::
+ forward () const
+ {
+ return this->forward_;
+ }
+
+ inline bool& cmd_ci_options::
+ forward ()
+ {
+ return this->forward_;
+ }
+
+ inline void cmd_ci_options::
+ forward (const bool& x)
+ {
+ this->forward_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/clean-options.cxx b/bdep/clean-options.cxx
new file mode 100644
index 0000000..8200b72
--- /dev/null
+++ b/bdep/clean-options.cxx
@@ -0,0 +1,758 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/clean-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_clean_options
+ //
+
+ cmd_clean_options::
+ cmd_clean_options ()
+ : immediate_ (),
+ recursive_ ()
+ {
+ }
+
+ bool cmd_clean_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_clean_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_clean_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_clean_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_clean_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_clean_options::
+ merge (const cmd_clean_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.immediate_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->immediate_, a.immediate_);
+ }
+
+ if (a.recursive_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->recursive_, a.recursive_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_clean_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mCLEAN OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--immediate\033[0m|\033[1m-i\033[0m Also clean immediate dependencies." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--recursive\033[0m|\033[1m-r\033[0m Also clean all dependencies, recursively." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_clean_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_clean_options_desc_type ()
+ {
+ ::bdep::cmd_clean_options::fill (*this);
+ }
+ };
+
+ void cmd_clean_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --immediate
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-i");
+ std::string dv;
+ ::bdep::cli::option o ("--immediate", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --recursive
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-r");
+ std::string dv;
+ ::bdep::cli::option o ("--recursive", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_clean_options::
+ description ()
+ {
+ static _cli_cmd_clean_options_desc_type _cli_cmd_clean_options_desc_;
+ return _cli_cmd_clean_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_clean_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_clean_options_map;
+
+ static _cli_cmd_clean_options_map _cli_cmd_clean_options_map_;
+
+ struct _cli_cmd_clean_options_map_init
+ {
+ _cli_cmd_clean_options_map_init ()
+ {
+ _cli_cmd_clean_options_map_["--immediate"] =
+ &::bdep::cli::thunk< cmd_clean_options, &cmd_clean_options::immediate_ >;
+ _cli_cmd_clean_options_map_["-i"] =
+ &::bdep::cli::thunk< cmd_clean_options, &cmd_clean_options::immediate_ >;
+ _cli_cmd_clean_options_map_["--recursive"] =
+ &::bdep::cli::thunk< cmd_clean_options, &cmd_clean_options::recursive_ >;
+ _cli_cmd_clean_options_map_["-r"] =
+ &::bdep::cli::thunk< cmd_clean_options, &cmd_clean_options::recursive_ >;
+ }
+ };
+
+ static _cli_cmd_clean_options_map_init _cli_cmd_clean_options_map_init_;
+
+ bool cmd_clean_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_clean_options_map::const_iterator i (_cli_cmd_clean_options_map_.find (o));
+
+ if (i != _cli_cmd_clean_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_clean_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_clean_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep clean\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mcfg-var\033[0m...]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mclean\033[0m command cleans the project packages in one or more build" << ::std::endl
+ << "configurations. Additionally, immediate or all dependencies of the project" << ::std::endl
+ << "packages can be cleaned by specifying the \033[1m--immediate\033[0m|\033[1m-i\033[0m\033[0m or \033[1m--recursive\033[0m|\033[1m-r\033[0m\033[0m" << ::std::endl
+ << "options, respectively." << ::std::endl
+ << ::std::endl
+ << "Underneath \033[1mclean\033[0m executes the \033[1mbpkg-pkg-clean(1)\033[0m command which itself is not" << ::std::endl
+ << "much more than the build system \033[1mclean\033[0m operation (see \033[1mb(1)\033[0m for details). As a" << ::std::endl
+ << "result, the main utility of this command is the ability to refer to build" << ::std::endl
+ << "configurations by names and to project packages implicitly via the current" << ::std::endl
+ << "working directory as well as to clean dependencies." << ::std::endl
+ << ::std::endl
+ << "If no project or package directory is specified, then the current working" << ::std::endl
+ << "directory is assumed. If no configuration is specified, then the default" << ::std::endl
+ << "configurations are assumed. See \033[1mbdep-projects-configs(1)\033[0m for details on" << ::std::endl
+ << "specifying projects and configurations. Optional \033[4mcfg-var\033[0m...\033[0m are the additional" << ::std::endl
+ << "configuration variables to pass to the build system." << ::std::endl;
+
+ p = ::bdep::cmd_clean_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mclean\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-clean.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mclean\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/clean-options.hxx b/bdep/clean-options.hxx
new file mode 100644
index 0000000..9f0ad65
--- /dev/null
+++ b/bdep/clean-options.hxx
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_CLEAN_OPTIONS_HXX
+#define BDEP_CLEAN_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_clean_options: public ::bdep::project_options
+ {
+ public:
+ cmd_clean_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_clean_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ immediate () const;
+
+ bool&
+ immediate ();
+
+ void
+ immediate (const bool&);
+
+ const bool&
+ recursive () const;
+
+ bool&
+ recursive ();
+
+ void
+ recursive (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_clean_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool immediate_;
+ bool recursive_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_clean_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/clean-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_CLEAN_OPTIONS_HXX
diff --git a/bdep/clean-options.ixx b/bdep/clean-options.ixx
new file mode 100644
index 0000000..e6270a0
--- /dev/null
+++ b/bdep/clean-options.ixx
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_clean_options
+ //
+
+ inline const bool& cmd_clean_options::
+ immediate () const
+ {
+ return this->immediate_;
+ }
+
+ inline bool& cmd_clean_options::
+ immediate ()
+ {
+ return this->immediate_;
+ }
+
+ inline void cmd_clean_options::
+ immediate (const bool& x)
+ {
+ this->immediate_ = x;
+ }
+
+ inline const bool& cmd_clean_options::
+ recursive () const
+ {
+ return this->recursive_;
+ }
+
+ inline bool& cmd_clean_options::
+ recursive ()
+ {
+ return this->recursive_;
+ }
+
+ inline void cmd_clean_options::
+ recursive (const bool& x)
+ {
+ this->recursive_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/common-options.cxx b/bdep/common-options.cxx
new file mode 100644
index 0000000..f386c04
--- /dev/null
+++ b/bdep/common-options.cxx
@@ -0,0 +1,2034 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/common-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+#include <fstream>
+
+namespace bdep
+{
+ namespace cli
+ {
+ // unknown_option
+ //
+ unknown_option::
+ ~unknown_option () noexcept
+ {
+ }
+
+ void unknown_option::
+ print (::std::ostream& os) const
+ {
+ os << "unknown option '" << option ().c_str () << "'";
+ }
+
+ const char* unknown_option::
+ what () const noexcept
+ {
+ return "unknown option";
+ }
+
+ // unknown_argument
+ //
+ unknown_argument::
+ ~unknown_argument () noexcept
+ {
+ }
+
+ void unknown_argument::
+ print (::std::ostream& os) const
+ {
+ os << "unknown argument '" << argument ().c_str () << "'";
+ }
+
+ const char* unknown_argument::
+ what () const noexcept
+ {
+ return "unknown argument";
+ }
+
+ // missing_value
+ //
+ missing_value::
+ ~missing_value () noexcept
+ {
+ }
+
+ void missing_value::
+ print (::std::ostream& os) const
+ {
+ os << "missing value for option '" << option ().c_str () << "'";
+ }
+
+ const char* missing_value::
+ what () const noexcept
+ {
+ return "missing option value";
+ }
+
+ // invalid_value
+ //
+ invalid_value::
+ ~invalid_value () noexcept
+ {
+ }
+
+ void invalid_value::
+ print (::std::ostream& os) const
+ {
+ os << "invalid value '" << value ().c_str () << "' for option '"
+ << option ().c_str () << "'";
+
+ if (!message ().empty ())
+ os << ": " << message ().c_str ();
+ }
+
+ const char* invalid_value::
+ what () const noexcept
+ {
+ return "invalid option value";
+ }
+
+ // eos_reached
+ //
+ void eos_reached::
+ print (::std::ostream& os) const
+ {
+ os << what ();
+ }
+
+ const char* eos_reached::
+ what () const noexcept
+ {
+ return "end of argument stream reached";
+ }
+
+ // file_io_failure
+ //
+ file_io_failure::
+ ~file_io_failure () noexcept
+ {
+ }
+
+ void file_io_failure::
+ print (::std::ostream& os) const
+ {
+ os << "unable to open file '" << file ().c_str () << "' or read failure";
+ }
+
+ const char* file_io_failure::
+ what () const noexcept
+ {
+ return "unable to open file or read failure";
+ }
+
+ // unmatched_quote
+ //
+ unmatched_quote::
+ ~unmatched_quote () noexcept
+ {
+ }
+
+ void unmatched_quote::
+ print (::std::ostream& os) const
+ {
+ os << "unmatched quote in argument '" << argument ().c_str () << "'";
+ }
+
+ const char* unmatched_quote::
+ what () const noexcept
+ {
+ return "unmatched quote";
+ }
+
+ // unexpected_group
+ //
+ unexpected_group::
+ ~unexpected_group () noexcept
+ {
+ }
+
+ void unexpected_group::
+ print (::std::ostream& os) const
+ {
+ os << "unexpected grouped argument '" << group_ << "' "
+ << "for argument '" << argument_ << "'";
+ }
+
+ const char* unexpected_group::
+ what () const noexcept
+ {
+ return "unexpected grouped argument";
+ }
+
+ // group_separator
+ //
+ group_separator::
+ ~group_separator () noexcept
+ {
+ }
+
+ void group_separator::
+ print (::std::ostream& os) const
+ {
+ bool ex (!expected_.empty ());
+ bool en (!encountered_.empty ());
+
+ if (ex)
+ {
+ os << "expected group separator '" << expected_ << "'";
+ if (en)
+ os << " instead of '" << encountered_ << "'";
+ }
+ else
+ os << "unexpected group separator '" << encountered_ << "'";
+
+ if (en)
+ os << ", use '\\" << encountered_ << "' to escape";
+ }
+
+ const char* group_separator::
+ what () const noexcept
+ {
+ bool ex (!expected_.empty ());
+ bool en (!encountered_.empty ());
+
+ return en
+ ? ex ? "wrong group separator" : "unexpected group separator"
+ : ex ? "expected group separator" : "";
+ }
+
+ // scanner
+ //
+ scanner::
+ ~scanner ()
+ {
+ }
+
+ // argv_scanner
+ //
+ bool argv_scanner::
+ more ()
+ {
+ return i_ < argc_;
+ }
+
+ const char* argv_scanner::
+ peek ()
+ {
+ if (i_ < argc_)
+ return argv_[i_];
+ else
+ throw eos_reached ();
+ }
+
+ const char* argv_scanner::
+ next ()
+ {
+ if (i_ < argc_)
+ {
+ const char* r (argv_[i_]);
+
+ if (erase_)
+ {
+ for (int i (i_ + 1); i < argc_; ++i)
+ argv_[i - 1] = argv_[i];
+
+ --argc_;
+ argv_[argc_] = 0;
+ }
+ else
+ ++i_;
+
+ ++start_position_;
+ return r;
+ }
+ else
+ throw eos_reached ();
+ }
+
+ void argv_scanner::
+ skip ()
+ {
+ if (i_ < argc_)
+ {
+ ++i_;
+ ++start_position_;
+ }
+ else
+ throw eos_reached ();
+ }
+
+ std::size_t argv_scanner::
+ position ()
+ {
+ return start_position_;
+ }
+
+ // vector_scanner
+ //
+ bool vector_scanner::
+ more ()
+ {
+ return i_ < v_.size ();
+ }
+
+ const char* vector_scanner::
+ peek ()
+ {
+ if (i_ < v_.size ())
+ return v_[i_].c_str ();
+ else
+ throw eos_reached ();
+ }
+
+ const char* vector_scanner::
+ next ()
+ {
+ if (i_ < v_.size ())
+ return v_[i_++].c_str ();
+ else
+ throw eos_reached ();
+ }
+
+ void vector_scanner::
+ skip ()
+ {
+ if (i_ < v_.size ())
+ ++i_;
+ else
+ throw eos_reached ();
+ }
+
+ std::size_t vector_scanner::
+ position ()
+ {
+ return start_position_ + i_;
+ }
+
+ // argv_file_scanner
+ //
+ int argv_file_scanner::zero_argc_ = 0;
+ std::string argv_file_scanner::empty_string_;
+
+ bool argv_file_scanner::
+ more ()
+ {
+ if (!args_.empty ())
+ return true;
+
+ while (base::more ())
+ {
+ // See if the next argument is the file option.
+ //
+ const char* a (base::peek ());
+ const option_info* oi = 0;
+ const char* ov = 0;
+
+ if (!skip_)
+ {
+ if ((oi = find (a)) != 0)
+ {
+ base::next ();
+
+ if (!base::more ())
+ throw missing_value (a);
+
+ ov = base::next ();
+ }
+ else if (std::strncmp (a, "-", 1) == 0)
+ {
+ if ((ov = std::strchr (a, '=')) != 0)
+ {
+ std::string o (a, 0, ov - a);
+ if ((oi = find (o.c_str ())) != 0)
+ {
+ base::next ();
+ ++ov;
+ }
+ }
+ }
+ }
+
+ if (oi != 0)
+ {
+ if (oi->search_func != 0)
+ {
+ std::string f (oi->search_func (ov, oi->arg));
+
+ if (!f.empty ())
+ load (f);
+ }
+ else
+ load (ov);
+
+ if (!args_.empty ())
+ return true;
+ }
+ else
+ {
+ if (!skip_)
+ skip_ = (std::strcmp (a, "--") == 0);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ const char* argv_file_scanner::
+ peek ()
+ {
+ if (!more ())
+ throw eos_reached ();
+
+ return args_.empty () ? base::peek () : args_.front ().value.c_str ();
+ }
+
+ const std::string& argv_file_scanner::
+ peek_file ()
+ {
+ if (!more ())
+ throw eos_reached ();
+
+ return args_.empty () ? empty_string_ : *args_.front ().file;
+ }
+
+ std::size_t argv_file_scanner::
+ peek_line ()
+ {
+ if (!more ())
+ throw eos_reached ();
+
+ return args_.empty () ? 0 : args_.front ().line;
+ }
+
+ const char* argv_file_scanner::
+ next ()
+ {
+ if (!more ())
+ throw eos_reached ();
+
+ if (args_.empty ())
+ return base::next ();
+ else
+ {
+ hold_[i_ == 0 ? ++i_ : --i_].swap (args_.front ().value);
+ args_.pop_front ();
+ ++start_position_;
+ return hold_[i_].c_str ();
+ }
+ }
+
+ void argv_file_scanner::
+ skip ()
+ {
+ if (!more ())
+ throw eos_reached ();
+
+ if (args_.empty ())
+ return base::skip ();
+ else
+ {
+ args_.pop_front ();
+ ++start_position_;
+ }
+ }
+
+ const argv_file_scanner::option_info* argv_file_scanner::
+ find (const char* a) const
+ {
+ for (std::size_t i (0); i < options_count_; ++i)
+ if (std::strcmp (a, options_[i].option) == 0)
+ return &options_[i];
+
+ return 0;
+ }
+
+ std::size_t argv_file_scanner::
+ position ()
+ {
+ return start_position_;
+ }
+
+ void argv_file_scanner::
+ load (const std::string& file)
+ {
+ using namespace std;
+
+ ifstream is (file.c_str ());
+
+ if (!is.is_open ())
+ throw file_io_failure (file);
+
+ files_.push_back (file);
+
+ arg a;
+ a.file = &*files_.rbegin ();
+
+ for (a.line = 1; !is.eof (); ++a.line)
+ {
+ string line;
+ getline (is, line);
+
+ if (is.fail () && !is.eof ())
+ throw file_io_failure (file);
+
+ string::size_type n (line.size ());
+
+ // Trim the line from leading and trailing whitespaces.
+ //
+ if (n != 0)
+ {
+ const char* f (line.c_str ());
+ const char* l (f + n);
+
+ const char* of (f);
+ while (f < l && (*f == ' ' || *f == '\t' || *f == '\r'))
+ ++f;
+
+ --l;
+
+ const char* ol (l);
+ while (l > f && (*l == ' ' || *l == '\t' || *l == '\r'))
+ --l;
+
+ if (f != of || l != ol)
+ line = f <= l ? string (f, l - f + 1) : string ();
+ }
+
+ // Ignore empty lines, those that start with #.
+ //
+ if (line.empty () || line[0] == '#')
+ continue;
+
+ string::size_type p (string::npos);
+ if (line.compare (0, 1, "-") == 0)
+ {
+ p = line.find (' ');
+
+ string::size_type q (line.find ('='));
+ if (q != string::npos && q < p)
+ p = q;
+ }
+
+ string s1;
+ if (p != string::npos)
+ {
+ s1.assign (line, 0, p);
+
+ // Skip leading whitespaces in the argument.
+ //
+ if (line[p] == '=')
+ ++p;
+ else
+ {
+ n = line.size ();
+ for (++p; p < n; ++p)
+ {
+ char c (line[p]);
+ if (c != ' ' && c != '\t' && c != '\r')
+ break;
+ }
+ }
+ }
+ else if (!skip_)
+ skip_ = (line == "--");
+
+ string s2 (line, p != string::npos ? p : 0);
+
+ // If the string (which is an option value or argument) is
+ // wrapped in quotes, remove them.
+ //
+ n = s2.size ();
+ char cf (s2[0]), cl (s2[n - 1]);
+
+ if (cf == '"' || cf == '\'' || cl == '"' || cl == '\'')
+ {
+ if (n == 1 || cf != cl)
+ throw unmatched_quote (s2);
+
+ s2 = string (s2, 1, n - 2);
+ }
+
+ if (!s1.empty ())
+ {
+ // See if this is another file option.
+ //
+ const option_info* oi;
+ if (!skip_ && (oi = find (s1.c_str ())))
+ {
+ if (s2.empty ())
+ throw missing_value (oi->option);
+
+ if (oi->search_func != 0)
+ {
+ string f (oi->search_func (s2.c_str (), oi->arg));
+ if (!f.empty ())
+ load (f);
+ }
+ else
+ {
+ // If the path of the file being parsed is not simple and the
+ // path of the file that needs to be loaded is relative, then
+ // complete the latter using the former as a base.
+ //
+#ifndef _WIN32
+ string::size_type p (file.find_last_of ('/'));
+ bool c (p != string::npos && s2[0] != '/');
+#else
+ string::size_type p (file.find_last_of ("/\\"));
+ bool c (p != string::npos && s2[1] != ':');
+#endif
+ if (c)
+ s2.insert (0, file, 0, p + 1);
+
+ load (s2);
+ }
+
+ continue;
+ }
+
+ a.value = s1;
+ args_.push_back (a);
+ }
+
+ a.value = s2;
+ args_.push_back (a);
+ }
+ }
+
+ // group_scanner
+ //
+ bool group_scanner::
+ more ()
+ {
+ // We don't want to call scan_group() here since that
+ // would invalidate references to previous arguments.
+ // But we do need to check that the previous group was
+ // handled.
+ //
+ if (state_ == scanned)
+ {
+ if (group_scan_.end () != group_.size ())
+ throw unexpected_group (arg_[i_][j_], group_scan_.next ());
+ }
+
+ return j_ != 0 || scan_.more ();
+ }
+
+ const char* group_scanner::
+ peek ()
+ {
+ if (state_ != peeked)
+ {
+ scan_group ();
+ state_ = peeked;
+ }
+
+ // Return unescaped.
+ return arg_[i_][j_ - 1].c_str ();
+ }
+
+ const char* group_scanner::
+ next ()
+ {
+ if (state_ != peeked)
+ scan_group ();
+ state_ = scanned;
+ // Return unescaped.
+ return arg_[i_][--j_].c_str ();
+ }
+
+ void group_scanner::
+ skip ()
+ {
+ if (state_ != peeked)
+ scan_group ();
+ state_ = skipped;
+ --j_;
+ }
+
+ std::size_t group_scanner::
+ position ()
+ {
+ return j_ == 0 ? scan_.position () : pos_ + (arg_[i_].size () - j_);
+ }
+
+ void group_scanner::
+ scan_group ()
+ {
+ // If the previous argument has been scanned, then make
+ // sure the group has been scanned (handled) as well.
+ //
+ if (state_ == scanned)
+ {
+ if (group_scan_.end () != group_.size ())
+ throw unexpected_group (arg_[i_][j_], group_scan_.next ());
+ }
+
+ // If we still have arguments in the pack, rewind the group.
+ //
+ if (j_ != 0)
+ {
+ group_scan_.reset ();
+ return;
+ }
+
+ i_ += (i_ == 0 ? 1 : -1);
+ group_.clear ();
+ group_scan_.reset ();
+ pos_ = scan_.position ();
+
+ // Note: using group_ won't cover empty groups and using
+ // j_ won't cover single-argument packs.
+ //
+ bool group (false), pack (false);
+
+ do
+ {
+ const char* a (scan_.next ());
+ size_t i (*a == '\\' ? 1 : 0);
+ separator s (sense (a + i));
+
+ if (s == none || i != 0)
+ {
+ if (arg_[i_].size () != 1)
+ arg_[i_].resize (1);
+
+ arg_[i_][0] = a + (s != none ? i : 0);
+ j_ = 1;
+ break;
+ }
+
+ // Start of a leading group for the next argument or
+ // argument pack. We will only know which once we see
+ // the closing separator.
+ //
+ if (s != open)
+ throw group_separator (a, "");
+
+ size_t n (group_.size ());
+
+ // Scan the group until the closing separator.
+ //
+ s = none;
+ while (s == none && scan_.more ())
+ {
+ a = scan_.next ();
+ i = (*a == '\\' ? 1 : 0);
+ s = sense (a + i);
+
+ if (s == none || i != 0)
+ {
+ group_.push_back (a + (s != none ? i : 0));
+ s = none;
+ }
+ }
+
+ if (s == close)
+ {
+ size_t m (group_.size ());
+
+ j_ = m - n;
+ if (j_ == 0)
+ throw group_separator ("{", "");
+
+ if (arg_[i_].size () != j_)
+ arg_[i_].resize (j_);
+
+ // Move from group_ to arg_. Add in reverse for ease
+ // of iteration.
+ //
+ for (size_t j (0); j != j_; ++j)
+ arg_[i_][j] = group_[m - j - 1];
+ group_.resize (n);
+
+ pack = true;
+ break;
+ }
+ else if (s == close_plus)
+ group = true;
+ else
+ throw group_separator ((s != none ? a : ""), "}+");
+ }
+ while (scan_.more ());
+
+ // Handle the case where we have seen the leading group
+ // but there are no more arguments.
+ //
+ if (group && j_ == 0)
+ throw group_separator ("{", "");
+
+ // Handle trailing groups, if any.
+ //
+ while (scan_.more ())
+ {
+ const char* a (scan_.peek ());
+ size_t i (*a == '\\' ? 1 : 0);
+ separator s (sense (a + i));
+
+ // Next argument, argument pack, or leading group.
+ //
+ if (s == none || s == open || i != 0)
+ break;
+
+ if (s != open_plus)
+ throw group_separator (a, "");
+
+ group = true;
+
+ // Scan the group until the closing separator.
+ //
+ scan_.next ();
+ s = none;
+ while (s == none && scan_.more ())
+ {
+ a = scan_.next ();
+ i = (*a == '\\' ? 1 : 0);
+ s = sense (a + i);
+
+ if (s == none || i != 0)
+ {
+ group_.push_back (a + (s != none ? i : 0));
+ s = none;
+ }
+ }
+
+ if (s != close)
+ throw group_separator ((s != none ? a : ""), "}");
+ }
+
+ // Handle the case where we have seen the argument pack
+ // without leading or trailing group.
+ //
+ if (pack && !group)
+ throw group_separator ("{", "");
+ }
+
+ void options::
+ push_back (const option& o)
+ {
+ container_type::size_type n (size ());
+ container_type::push_back (o);
+ map_[o.name ()] = n;
+
+ for (option_names::const_iterator i (o.aliases ().begin ());
+ i != o.aliases ().end (); ++i)
+ map_[*i] = n;
+ }
+
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // common_options
+ //
+
+ common_options::
+ common_options ()
+ : v_ (),
+ V_ (),
+ quiet_ (),
+ verbose_ (1),
+ verbose_specified_ (false),
+ stdout_format_ (bdep::stdout_format::lines),
+ stdout_format_specified_ (false),
+ jobs_ (),
+ jobs_specified_ (false),
+ progress_ (),
+ no_progress_ (),
+ diag_color_ (),
+ no_diag_color_ (),
+ bpkg_ (),
+ bpkg_specified_ (false),
+ bpkg_option_ (),
+ bpkg_option_specified_ (false),
+ build_ (),
+ build_specified_ (false),
+ build_option_ (),
+ build_option_specified_ (false),
+ curl_ ("curl"),
+ curl_specified_ (false),
+ curl_option_ (),
+ curl_option_specified_ (false),
+ pager_ (),
+ pager_specified_ (false),
+ pager_option_ (),
+ pager_option_specified_ (false),
+ options_file_ (),
+ options_file_specified_ (false),
+ default_options_ (),
+ default_options_specified_ (false),
+ no_default_options_ ()
+ {
+ }
+
+ void common_options::
+ merge (const common_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.v_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->v_, a.v_);
+ }
+
+ if (a.V_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->V_, a.V_);
+ }
+
+ if (a.quiet_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->quiet_, a.quiet_);
+ }
+
+ if (a.verbose_specified_)
+ {
+ ::bdep::cli::parser< uint16_t>::merge (
+ this->verbose_, a.verbose_);
+ this->verbose_specified_ = true;
+ }
+
+ if (a.stdout_format_specified_)
+ {
+ ::bdep::cli::parser< bdep::stdout_format>::merge (
+ this->stdout_format_, a.stdout_format_);
+ this->stdout_format_specified_ = true;
+ }
+
+ if (a.jobs_specified_)
+ {
+ ::bdep::cli::parser< size_t>::merge (
+ this->jobs_, a.jobs_);
+ this->jobs_specified_ = true;
+ }
+
+ if (a.progress_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->progress_, a.progress_);
+ }
+
+ if (a.no_progress_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_progress_, a.no_progress_);
+ }
+
+ if (a.diag_color_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->diag_color_, a.diag_color_);
+ }
+
+ if (a.no_diag_color_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_diag_color_, a.no_diag_color_);
+ }
+
+ if (a.bpkg_specified_)
+ {
+ ::bdep::cli::parser< path>::merge (
+ this->bpkg_, a.bpkg_);
+ this->bpkg_specified_ = true;
+ }
+
+ if (a.bpkg_option_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->bpkg_option_, a.bpkg_option_);
+ this->bpkg_option_specified_ = true;
+ }
+
+ if (a.build_specified_)
+ {
+ ::bdep::cli::parser< path>::merge (
+ this->build_, a.build_);
+ this->build_specified_ = true;
+ }
+
+ if (a.build_option_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->build_option_, a.build_option_);
+ this->build_option_specified_ = true;
+ }
+
+ if (a.curl_specified_)
+ {
+ ::bdep::cli::parser< path>::merge (
+ this->curl_, a.curl_);
+ this->curl_specified_ = true;
+ }
+
+ if (a.curl_option_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->curl_option_, a.curl_option_);
+ this->curl_option_specified_ = true;
+ }
+
+ if (a.pager_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->pager_, a.pager_);
+ this->pager_specified_ = true;
+ }
+
+ if (a.pager_option_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->pager_option_, a.pager_option_);
+ this->pager_option_specified_ = true;
+ }
+
+ if (a.options_file_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->options_file_, a.options_file_);
+ this->options_file_specified_ = true;
+ }
+
+ if (a.default_options_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->default_options_, a.default_options_);
+ this->default_options_specified_ = true;
+ }
+
+ if (a.no_default_options_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_default_options_, a.no_default_options_);
+ }
+ }
+
+ ::bdep::cli::usage_para common_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mCOMMON OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "The common options are summarized below with a more detailed description" << ::std::endl
+ << "available in \033[1mbdep-common-options(1)\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m-v\033[0m Print essential underlying commands being executed." << ::std::endl;
+
+ os << "\033[1m-V\033[0m Print all underlying commands being executed." << ::std::endl;
+
+ os << "\033[1m--quiet\033[0m|\033[1m-q\033[0m Run quietly, only printing error messages." << ::std::endl;
+
+ os << "\033[1m--verbose\033[0m \033[4mlevel\033[0m Set the diagnostics verbosity to \033[4mlevel\033[0m between 0 and" << ::std::endl
+ << " 6." << ::std::endl;
+
+ os << "\033[1m--stdout-format\033[0m \033[4mformat\033[0m Representation format to use for printing to \033[1mstdout\033[0m." << ::std::endl;
+
+ os << "\033[1m--jobs\033[0m|\033[1m-j\033[0m \033[4mnum\033[0m Number of jobs to perform in parallel." << ::std::endl;
+
+ os << "\033[1m--progress\033[0m Display progress indicators for long-lasting" << ::std::endl
+ << " operations, such as network transfers, building, etc." << ::std::endl;
+
+ os << "\033[1m--no-progress\033[0m Suppress progress indicators for long-lasting" << ::std::endl
+ << " operations, such as network transfers, building, etc." << ::std::endl;
+
+ os << "\033[1m--diag-color\033[0m Use color in diagnostics." << ::std::endl;
+
+ os << "\033[1m--no-diag-color\033[0m Don't use color in diagnostics." << ::std::endl;
+
+ os << "\033[1m--bpkg\033[0m \033[4mpath\033[0m The package manager program to be used for build" << ::std::endl
+ << " configuration management." << ::std::endl;
+
+ os << "\033[1m--bpkg-option\033[0m \033[4mopt\033[0m Additional option to be passed to the package manager" << ::std::endl
+ << " program." << ::std::endl;
+
+ os << "\033[1m--build\033[0m \033[4mpath\033[0m The build program to be used to build packages." << ::std::endl;
+
+ os << "\033[1m--build-option\033[0m \033[4mopt\033[0m Additional option to be passed to the build program." << ::std::endl;
+
+ os << "\033[1m--curl\033[0m \033[4mpath\033[0m The curl program to be used for network operations." << ::std::endl;
+
+ os << "\033[1m--curl-option\033[0m \033[4mopt\033[0m Additional option to be passed to the curl program." << ::std::endl;
+
+ os << "\033[1m--pager\033[0m \033[4mpath\033[0m The pager program to be used to show long text." << ::std::endl;
+
+ os << "\033[1m--pager-option\033[0m \033[4mopt\033[0m Additional option to be passed to the pager program." << ::std::endl;
+
+ os << "\033[1m--options-file\033[0m \033[4mfile\033[0m Read additional options from \033[4mfile\033[0m." << ::std::endl;
+
+ os << "\033[1m--default-options\033[0m \033[4mdir\033[0m The directory to load additional default options" << ::std::endl
+ << " files from." << ::std::endl;
+
+ os << "\033[1m--no-default-options\033[0m Don't load default options files." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ return p;
+ }
+
+ ::bdep::cli::usage_para common_options::
+ print_long_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mCOMMON OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m-v\033[0m Print essential underlying commands being executed." << ::std::endl
+ << " This is equivalent to \033[1m--verbose 2\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m-V\033[0m Print all underlying commands being executed. This is" << ::std::endl
+ << " equivalent to \033[1m--verbose 3\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--quiet\033[0m|\033[1m-q\033[0m Run quietly, only printing error messages. This is" << ::std::endl
+ << " equivalent to \033[1m--verbose 0\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--verbose\033[0m \033[4mlevel\033[0m Set the diagnostics verbosity to \033[4mlevel\033[0m between 0 and" << ::std::endl
+ << " 6. Level 0 disables any non-error messages while" << ::std::endl
+ << " level 6 produces lots of information, with level 1" << ::std::endl
+ << " being the default. The following additional types of" << ::std::endl
+ << " diagnostics are produced at each level:" << ::std::endl
+ << ::std::endl
+ << " 1. High-level information messages." << ::std::endl
+ << " 2. Essential underlying commands being executed." << ::std::endl
+ << " 3. All underlying commands being executed." << ::std::endl
+ << " 4. Information that could be helpful to the user." << ::std::endl
+ << " 5. Information that could be helpful to the" << ::std::endl
+ << " developer." << ::std::endl
+ << " 6. Even more detailed information." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--stdout-format\033[0m \033[4mformat\033[0m Representation format to use for printing to \033[1mstdout\033[0m." << ::std::endl
+ << " Valid values for this option are \033[1mlines\033[0m (default) and" << ::std::endl
+ << " \033[1mjson\033[0m. See the JSON OUTPUT section below for details" << ::std::endl
+ << " on the \033[1mjson\033[0m format." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--jobs\033[0m|\033[1m-j\033[0m \033[4mnum\033[0m Number of jobs to perform in parallel. If this option" << ::std::endl
+ << " is not specified or specified with the 0\033[0m value, then" << ::std::endl
+ << " the number of available hardware threads is used." << ::std::endl
+ << " This option is also propagated when executing package" << ::std::endl
+ << " manager commands such as \033[1mbpkg-pkg-update(1)\033[0m," << ::std::endl
+ << " \033[1mbpkg-pkg-test(1)\033[0m, etc., which in turn propagate it to" << ::std::endl
+ << " the build system." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--progress\033[0m Display progress indicators for long-lasting" << ::std::endl
+ << " operations, such as network transfers, building, etc." << ::std::endl
+ << " If printing to a terminal the progress is displayed" << ::std::endl
+ << " by default for low verbosity levels. Use" << ::std::endl
+ << " \033[1m--no-progress\033[0m to suppress." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-progress\033[0m Suppress progress indicators for long-lasting" << ::std::endl
+ << " operations, such as network transfers, building, etc." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--diag-color\033[0m Use color in diagnostics. If printing to a terminal" << ::std::endl
+ << " the color is used by default provided the terminal is" << ::std::endl
+ << " not dumb. Use \033[1m--no-diag-color\033[0m to suppress." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-diag-color\033[0m Don't use color in diagnostics." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--bpkg\033[0m \033[4mpath\033[0m The package manager program to be used for build" << ::std::endl
+ << " configuration management. This should be the path to" << ::std::endl
+ << " the \033[1mbpkg\033[0m executable. You can also specify additional" << ::std::endl
+ << " options that should be passed to the package manager" << ::std::endl
+ << " program with \033[1m--bpkg-option\033[0m." << ::std::endl
+ << ::std::endl
+ << " If the package manager program is not explicitly" << ::std::endl
+ << " specified, then \033[1mbdep\033[0m will by default use \033[1mbpkg\033[0m plus an" << ::std::endl
+ << " executable suffix if one was specified when building" << ::std::endl
+ << " \033[1mbdep\033[0m. So, for example, if \033[1mbdep\033[0m name was set to" << ::std::endl
+ << " \033[1mbdep-1.0\033[0m, then it will look for \033[1mbpkg-1.0\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--bpkg-option\033[0m \033[4mopt\033[0m Additional option to be passed to the package manager" << ::std::endl
+ << " program. See \033[1m--bpkg\033[0m for more information on the" << ::std::endl
+ << " package manager program. Repeat this option to" << ::std::endl
+ << " specify multiple package manager options." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--build\033[0m \033[4mpath\033[0m The build program to be used to build packages. This" << ::std::endl
+ << " should be the path to the build2 \033[1mb\033[0m executable. You" << ::std::endl
+ << " can also specify additional options that should be" << ::std::endl
+ << " passed to the build program with \033[1m--build-option\033[0m." << ::std::endl
+ << ::std::endl
+ << " If the build program is not explicitly specified," << ::std::endl
+ << " then \033[1mbdep\033[0m will by default use \033[1mb\033[0m plus an executable" << ::std::endl
+ << " suffix if one was specified when building \033[1mbdep\033[0m. So," << ::std::endl
+ << " for example, if \033[1mbdep\033[0m name was set to \033[1mbdep-1.0\033[0m, then" << ::std::endl
+ << " it will look for \033[1mb-1.0\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--build-option\033[0m \033[4mopt\033[0m Additional option to be passed to the build program." << ::std::endl
+ << " See \033[1m--build\033[0m for more information on the build" << ::std::endl
+ << " program. Repeat this option to specify multiple build" << ::std::endl
+ << " options." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--curl\033[0m \033[4mpath\033[0m The curl program to be used for network operations." << ::std::endl
+ << " You can also specify additional options that should" << ::std::endl
+ << " be passed to the curl program with \033[1m--curl-option\033[0m." << ::std::endl
+ << ::std::endl
+ << " If the curl program is not explicitly specified, then" << ::std::endl
+ << " \033[1mbdep\033[0m will use \033[1mcurl\033[0m by default. Note that this program" << ::std::endl
+ << " will also be used by the underlying \033[1mbpkg\033[0m invocations" << ::std::endl
+ << " unless overridden." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--curl-option\033[0m \033[4mopt\033[0m Additional option to be passed to the curl program." << ::std::endl
+ << " See \033[1m--curl\033[0m for more information on the curl program." << ::std::endl
+ << " Repeat this option to specify multiple curl options." << ::std::endl
+ << ::std::endl
+ << " Note that these options will also be used by the" << ::std::endl
+ << " underlying \033[1mbpkg\033[0m invocations provided that curl is" << ::std::endl
+ << " used." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--pager\033[0m \033[4mpath\033[0m The pager program to be used to show long text." << ::std::endl
+ << " Commonly used pager programs are \033[1mless\033[0m and \033[1mmore\033[0m. You" << ::std::endl
+ << " can also specify additional options that should be" << ::std::endl
+ << " passed to the pager program with \033[1m--pager-option\033[0m. If" << ::std::endl
+ << " an empty string is specified as the pager program," << ::std::endl
+ << " then no pager will be used. If the pager program is" << ::std::endl
+ << " not explicitly specified, then \033[1mbdep\033[0m will try to use" << ::std::endl
+ << " \033[1mless\033[0m. If it is not available, then no pager will be" << ::std::endl
+ << " used." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--pager-option\033[0m \033[4mopt\033[0m Additional option to be passed to the pager program." << ::std::endl
+ << " See \033[1m--pager\033[0m for more information on the pager" << ::std::endl
+ << " program. Repeat this option to specify multiple pager" << ::std::endl
+ << " options." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--options-file\033[0m \033[4mfile\033[0m Read additional options from \033[4mfile\033[0m. Each option should" << ::std::endl
+ << " appear on a separate line optionally followed by" << ::std::endl
+ << " space or equal sign (\033[1m=\033[0m) and an option value. Empty" << ::std::endl
+ << " lines and lines starting with \033[1m#\033[0m are ignored. Option" << ::std::endl
+ << " values can be enclosed in double (\033[1m\"\033[0m) or single (\033[1m'\033[0m)" << ::std::endl
+ << " quotes to preserve leading and trailing whitespaces" << ::std::endl
+ << " as well as to specify empty values. If the value" << ::std::endl
+ << " itself contains trailing or leading quotes, enclose" << ::std::endl
+ << " it with an extra pair of quotes, for example \033[1m'\"x\"'\033[0m." << ::std::endl
+ << " Non-leading and non-trailing quotes are interpreted" << ::std::endl
+ << " as being part of the option value." << ::std::endl
+ << ::std::endl
+ << " The semantics of providing options in a file is" << ::std::endl
+ << " equivalent to providing the same set of options in" << ::std::endl
+ << " the same order on the command line at the point where" << ::std::endl
+ << " the \033[1m--options-file\033[0m option is specified except that" << ::std::endl
+ << " the shell escaping and quoting is not required." << ::std::endl
+ << " Repeat this option to specify more than one options" << ::std::endl
+ << " file." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--default-options\033[0m \033[4mdir\033[0m The directory to load additional default options" << ::std::endl
+ << " files from." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-default-options\033[0m Don't load default options files." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ return p;
+ }
+
+ struct _cli_common_options_desc_type: ::bdep::cli::options
+ {
+ _cli_common_options_desc_type ()
+ {
+ ::bdep::common_options::fill (*this);
+ }
+ };
+
+ void common_options::
+ fill (::bdep::cli::options& os)
+ {
+ // -v
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("-v", a, true, dv);
+ os.push_back (o);
+ }
+
+ // -V
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("-V", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --quiet
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-q");
+ std::string dv;
+ ::bdep::cli::option o ("--quiet", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --verbose
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("1");
+ ::bdep::cli::option o ("--verbose", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --stdout-format
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--stdout-format", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --jobs
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-j");
+ std::string dv;
+ ::bdep::cli::option o ("--jobs", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --progress
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--progress", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-progress
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-progress", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --diag-color
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--diag-color", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-diag-color
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-diag-color", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --bpkg
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--bpkg", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --bpkg-option
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--bpkg-option", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --build
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--build", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --build-option
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--build-option", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --curl
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("curl");
+ ::bdep::cli::option o ("--curl", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --curl-option
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--curl-option", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --pager
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--pager", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --pager-option
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--pager-option", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --options-file
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--options-file", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --default-options
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--default-options", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --no-default-options
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-default-options", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& common_options::
+ description ()
+ {
+ static _cli_common_options_desc_type _cli_common_options_desc_;
+ return _cli_common_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (common_options&, ::bdep::cli::scanner&)>
+ _cli_common_options_map;
+
+ static _cli_common_options_map _cli_common_options_map_;
+
+ struct _cli_common_options_map_init
+ {
+ _cli_common_options_map_init ()
+ {
+ _cli_common_options_map_["-v"] =
+ &::bdep::cli::thunk< common_options, &common_options::v_ >;
+ _cli_common_options_map_["-V"] =
+ &::bdep::cli::thunk< common_options, &common_options::V_ >;
+ _cli_common_options_map_["--quiet"] =
+ &::bdep::cli::thunk< common_options, &common_options::quiet_ >;
+ _cli_common_options_map_["-q"] =
+ &::bdep::cli::thunk< common_options, &common_options::quiet_ >;
+ _cli_common_options_map_["--verbose"] =
+ &::bdep::cli::thunk< common_options, uint16_t, &common_options::verbose_,
+ &common_options::verbose_specified_ >;
+ _cli_common_options_map_["--stdout-format"] =
+ &::bdep::cli::thunk< common_options, bdep::stdout_format, &common_options::stdout_format_,
+ &common_options::stdout_format_specified_ >;
+ _cli_common_options_map_["--jobs"] =
+ &::bdep::cli::thunk< common_options, size_t, &common_options::jobs_,
+ &common_options::jobs_specified_ >;
+ _cli_common_options_map_["-j"] =
+ &::bdep::cli::thunk< common_options, size_t, &common_options::jobs_,
+ &common_options::jobs_specified_ >;
+ _cli_common_options_map_["--progress"] =
+ &::bdep::cli::thunk< common_options, &common_options::progress_ >;
+ _cli_common_options_map_["--no-progress"] =
+ &::bdep::cli::thunk< common_options, &common_options::no_progress_ >;
+ _cli_common_options_map_["--diag-color"] =
+ &::bdep::cli::thunk< common_options, &common_options::diag_color_ >;
+ _cli_common_options_map_["--no-diag-color"] =
+ &::bdep::cli::thunk< common_options, &common_options::no_diag_color_ >;
+ _cli_common_options_map_["--bpkg"] =
+ &::bdep::cli::thunk< common_options, path, &common_options::bpkg_,
+ &common_options::bpkg_specified_ >;
+ _cli_common_options_map_["--bpkg-option"] =
+ &::bdep::cli::thunk< common_options, strings, &common_options::bpkg_option_,
+ &common_options::bpkg_option_specified_ >;
+ _cli_common_options_map_["--build"] =
+ &::bdep::cli::thunk< common_options, path, &common_options::build_,
+ &common_options::build_specified_ >;
+ _cli_common_options_map_["--build-option"] =
+ &::bdep::cli::thunk< common_options, strings, &common_options::build_option_,
+ &common_options::build_option_specified_ >;
+ _cli_common_options_map_["--curl"] =
+ &::bdep::cli::thunk< common_options, path, &common_options::curl_,
+ &common_options::curl_specified_ >;
+ _cli_common_options_map_["--curl-option"] =
+ &::bdep::cli::thunk< common_options, strings, &common_options::curl_option_,
+ &common_options::curl_option_specified_ >;
+ _cli_common_options_map_["--pager"] =
+ &::bdep::cli::thunk< common_options, string, &common_options::pager_,
+ &common_options::pager_specified_ >;
+ _cli_common_options_map_["--pager-option"] =
+ &::bdep::cli::thunk< common_options, strings, &common_options::pager_option_,
+ &common_options::pager_option_specified_ >;
+ _cli_common_options_map_["--options-file"] =
+ &::bdep::cli::thunk< common_options, string, &common_options::options_file_,
+ &common_options::options_file_specified_ >;
+ _cli_common_options_map_["--default-options"] =
+ &::bdep::cli::thunk< common_options, dir_path, &common_options::default_options_,
+ &common_options::default_options_specified_ >;
+ _cli_common_options_map_["--no-default-options"] =
+ &::bdep::cli::thunk< common_options, &common_options::no_default_options_ >;
+ }
+ };
+
+ static _cli_common_options_map_init _cli_common_options_map_init_;
+
+ bool common_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_common_options_map::const_iterator i (_cli_common_options_map_.find (o));
+
+ if (i != _cli_common_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_common_options_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep\033[0m [\033[4mcommon-options\033[0m] ...\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The common options control behavior that is common to all or most of the \033[1mbdep\033[0m" << ::std::endl
+ << "commands. They can be specified either before the command or after, together" << ::std::endl
+ << "with the command-specific options." << ::std::endl;
+
+ p = ::bdep::common_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mJSON OUTPUT\033[0m" << ::std::endl
+ << ::std::endl
+ << "Commands that support the JSON output specify their formats as a serialized" << ::std::endl
+ << "representation of a C++ \033[1mstruct\033[0m or an array thereof. For example:" << ::std::endl
+ << ::std::endl
+ << "struct package" << ::std::endl
+ << "{" << ::std::endl
+ << " string name;" << ::std::endl
+ << "};" << ::std::endl
+ << ::std::endl
+ << "struct configuration" << ::std::endl
+ << "{" << ::std::endl
+ << " uint64_t id;" << ::std::endl
+ << " string path;" << ::std::endl
+ << " optional<string> name;" << ::std::endl
+ << " bool default;" << ::std::endl
+ << " vector<package> packages;" << ::std::endl
+ << "};" << ::std::endl
+ << ::std::endl
+ << "An example of the serialized JSON representation of \033[1mstruct\033[0m \033[1mconfiguration\033[0m:" << ::std::endl
+ << ::std::endl
+ << "{" << ::std::endl
+ << " \"id\": 1," << ::std::endl
+ << " \"path\": \"/tmp/hello-gcc\"," << ::std::endl
+ << " \"name\": \"gcc\"," << ::std::endl
+ << " \"default\": true," << ::std::endl
+ << " \"packages\": [" << ::std::endl
+ << " {" << ::std::endl
+ << " \"name\": \"hello\"" << ::std::endl
+ << " }" << ::std::endl
+ << " ]" << ::std::endl
+ << "}" << ::std::endl
+ << ::std::endl
+ << "This sections provides details on the overall properties of such formats and" << ::std::endl
+ << "the semantics of the \033[1mstruct\033[0m serialization." << ::std::endl
+ << ::std::endl
+ << "The order of members in a JSON object is fixed as specified in the" << ::std::endl
+ << "corresponding \033[1mstruct\033[0m. While new members may be added in the future (and should" << ::std::endl
+ << "be ignored by older consumers), the semantics of the existing members" << ::std::endl
+ << "(including whether the top-level entry is an object or array) may not change." << ::std::endl
+ << ::std::endl
+ << "An object member is required unless its type is \033[1moptional<>\033[0m, \033[1mbool\033[0m, or \033[1mvector<>\033[0m" << ::std::endl
+ << "(array). For \033[1mbool\033[0m members absent means \033[1mfalse\033[0m. For \033[1mvector<>\033[0m members absent means" << ::std::endl
+ << "empty. An empty top-level array is always present." << ::std::endl
+ << ::std::endl
+ << "For example, the following JSON text is a possible serialization of the above" << ::std::endl
+ << "\033[1mstruct\033[0m \033[1mconfiguration\033[0m:" << ::std::endl
+ << ::std::endl
+ << "{" << ::std::endl
+ << " \"id\": 1," << ::std::endl
+ << " \"path\": \"/tmp/hello-gcc\"" << ::std::endl
+ << "}" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+
+ ::bdep::cli::usage_para
+ print_bdep_common_options_long_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep\033[0m [\033[4mcommon-options\033[0m] ...\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The common options control behavior that is common to all or most of the \033[1mbdep\033[0m" << ::std::endl
+ << "commands. They can be specified either before the command or after, together" << ::std::endl
+ << "with the command-specific options." << ::std::endl;
+
+ p = ::bdep::common_options::print_long_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mJSON OUTPUT\033[0m" << ::std::endl
+ << ::std::endl
+ << "Commands that support the JSON output specify their formats as a serialized" << ::std::endl
+ << "representation of a C++ \033[1mstruct\033[0m or an array thereof. For example:" << ::std::endl
+ << ::std::endl
+ << "struct package" << ::std::endl
+ << "{" << ::std::endl
+ << " string name;" << ::std::endl
+ << "};" << ::std::endl
+ << ::std::endl
+ << "struct configuration" << ::std::endl
+ << "{" << ::std::endl
+ << " uint64_t id;" << ::std::endl
+ << " string path;" << ::std::endl
+ << " optional<string> name;" << ::std::endl
+ << " bool default;" << ::std::endl
+ << " vector<package> packages;" << ::std::endl
+ << "};" << ::std::endl
+ << ::std::endl
+ << "An example of the serialized JSON representation of \033[1mstruct\033[0m \033[1mconfiguration\033[0m:" << ::std::endl
+ << ::std::endl
+ << "{" << ::std::endl
+ << " \"id\": 1," << ::std::endl
+ << " \"path\": \"/tmp/hello-gcc\"," << ::std::endl
+ << " \"name\": \"gcc\"," << ::std::endl
+ << " \"default\": true," << ::std::endl
+ << " \"packages\": [" << ::std::endl
+ << " {" << ::std::endl
+ << " \"name\": \"hello\"" << ::std::endl
+ << " }" << ::std::endl
+ << " ]" << ::std::endl
+ << "}" << ::std::endl
+ << ::std::endl
+ << "This sections provides details on the overall properties of such formats and" << ::std::endl
+ << "the semantics of the \033[1mstruct\033[0m serialization." << ::std::endl
+ << ::std::endl
+ << "The order of members in a JSON object is fixed as specified in the" << ::std::endl
+ << "corresponding \033[1mstruct\033[0m. While new members may be added in the future (and should" << ::std::endl
+ << "be ignored by older consumers), the semantics of the existing members" << ::std::endl
+ << "(including whether the top-level entry is an object or array) may not change." << ::std::endl
+ << ::std::endl
+ << "An object member is required unless its type is \033[1moptional<>\033[0m, \033[1mbool\033[0m, or \033[1mvector<>\033[0m" << ::std::endl
+ << "(array). For \033[1mbool\033[0m members absent means \033[1mfalse\033[0m. For \033[1mvector<>\033[0m members absent means" << ::std::endl
+ << "empty. An empty top-level array is always present." << ::std::endl
+ << ::std::endl
+ << "For example, the following JSON text is a possible serialization of the above" << ::std::endl
+ << "\033[1mstruct\033[0m \033[1mconfiguration\033[0m:" << ::std::endl
+ << ::std::endl
+ << "{" << ::std::endl
+ << " \"id\": 1," << ::std::endl
+ << " \"path\": \"/tmp/hello-gcc\"" << ::std::endl
+ << "}" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/common-options.hxx b/bdep/common-options.hxx
new file mode 100644
index 0000000..fb9af76
--- /dev/null
+++ b/bdep/common-options.hxx
@@ -0,0 +1,1012 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_COMMON_OPTIONS_HXX
+#define BDEP_COMMON_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <list>
+#include <deque>
+#include <map>
+#include <vector>
+#include <iosfwd>
+#include <string>
+#include <cstddef>
+#include <exception>
+
+#ifndef CLI_POTENTIALLY_UNUSED
+# if defined(_MSC_VER) || defined(__xlC__)
+# define CLI_POTENTIALLY_UNUSED(x) (void*)&x
+# else
+# define CLI_POTENTIALLY_UNUSED(x) (void)x
+# endif
+#endif
+
+namespace bdep
+{
+ namespace cli
+ {
+ class usage_para
+ {
+ public:
+ enum value
+ {
+ none,
+ text,
+ option
+ };
+
+ usage_para (value);
+
+ operator value () const
+ {
+ return v_;
+ }
+
+ private:
+ value v_;
+ };
+
+ class unknown_mode
+ {
+ public:
+ enum value
+ {
+ skip,
+ stop,
+ fail
+ };
+
+ unknown_mode (value);
+
+ operator value () const
+ {
+ return v_;
+ }
+
+ private:
+ value v_;
+ };
+
+ // Exceptions.
+ //
+
+ class exception: public std::exception
+ {
+ public:
+ virtual void
+ print (::std::ostream&) const = 0;
+ };
+
+ ::std::ostream&
+ operator<< (::std::ostream&, const exception&);
+
+ class unknown_option: public exception
+ {
+ public:
+ virtual
+ ~unknown_option () noexcept;
+
+ unknown_option (const std::string& option);
+
+ const std::string&
+ option () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string option_;
+ };
+
+ class unknown_argument: public exception
+ {
+ public:
+ virtual
+ ~unknown_argument () noexcept;
+
+ unknown_argument (const std::string& argument);
+
+ const std::string&
+ argument () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string argument_;
+ };
+
+ class missing_value: public exception
+ {
+ public:
+ virtual
+ ~missing_value () noexcept;
+
+ missing_value (const std::string& option);
+
+ const std::string&
+ option () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string option_;
+ };
+
+ class invalid_value: public exception
+ {
+ public:
+ virtual
+ ~invalid_value () noexcept;
+
+ invalid_value (const std::string& option,
+ const std::string& value,
+ const std::string& message = std::string ());
+
+ const std::string&
+ option () const;
+
+ const std::string&
+ value () const;
+
+ const std::string&
+ message () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string option_;
+ std::string value_;
+ std::string message_;
+ };
+
+ class eos_reached: public exception
+ {
+ public:
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+ };
+
+ class file_io_failure: public exception
+ {
+ public:
+ virtual
+ ~file_io_failure () noexcept;
+
+ file_io_failure (const std::string& file);
+
+ const std::string&
+ file () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string file_;
+ };
+
+ class unmatched_quote: public exception
+ {
+ public:
+ virtual
+ ~unmatched_quote () noexcept;
+
+ unmatched_quote (const std::string& argument);
+
+ const std::string&
+ argument () const;
+
+ virtual void
+ print (::std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string argument_;
+ };
+
+ class unexpected_group: public exception
+ {
+ public:
+ virtual
+ ~unexpected_group () noexcept;
+
+ unexpected_group (const std::string& argument,
+ const std::string& group);
+
+ const std::string&
+ argument () const;
+
+ const std::string&
+ group () const;
+
+ virtual void
+ print (std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string argument_;
+ std::string group_;
+ };
+
+ class group_separator: public exception
+ {
+ public:
+ virtual
+ ~group_separator () noexcept;
+
+ // Note: either (but not both) can be empty.
+ //
+ group_separator (const std::string& encountered,
+ const std::string& expected);
+
+ const std::string&
+ encountered () const;
+
+ const std::string&
+ expected () const;
+
+ virtual void
+ print (std::ostream&) const;
+
+ virtual const char*
+ what () const noexcept;
+
+ private:
+ std::string encountered_;
+ std::string expected_;
+ };
+
+ // Command line argument scanner interface.
+ //
+ // The values returned by next() are guaranteed to be valid
+ // for the two previous arguments up until a call to a third
+ // peek() or next().
+ //
+ // The position() function returns a monotonically-increasing
+ // number which, if stored, can later be used to determine the
+ // relative position of the argument returned by the following
+ // call to next(). Note that if multiple scanners are used to
+ // extract arguments from multiple sources, then the end
+ // position of the previous scanner should be used as the
+ // start position of the next.
+ //
+ class scanner
+ {
+ public:
+ virtual
+ ~scanner ();
+
+ virtual bool
+ more () = 0;
+
+ virtual const char*
+ peek () = 0;
+
+ virtual const char*
+ next () = 0;
+
+ virtual void
+ skip () = 0;
+
+ virtual std::size_t
+ position () = 0;
+ };
+
+ class argv_scanner: public scanner
+ {
+ public:
+ argv_scanner (int& argc,
+ char** argv,
+ bool erase = false,
+ std::size_t start_position = 0);
+
+ argv_scanner (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ std::size_t start_position = 0);
+
+ int
+ end () const;
+
+ virtual bool
+ more ();
+
+ virtual const char*
+ peek ();
+
+ virtual const char*
+ next ();
+
+ virtual void
+ skip ();
+
+ virtual std::size_t
+ position ();
+
+ protected:
+ std::size_t start_position_;
+ int i_;
+ int& argc_;
+ char** argv_;
+ bool erase_;
+ };
+
+ class vector_scanner: public scanner
+ {
+ public:
+ vector_scanner (const std::vector<std::string>&,
+ std::size_t start = 0,
+ std::size_t start_position = 0);
+
+ std::size_t
+ end () const;
+
+ void
+ reset (std::size_t start = 0, std::size_t start_position = 0);
+
+ virtual bool
+ more ();
+
+ virtual const char*
+ peek ();
+
+ virtual const char*
+ next ();
+
+ virtual void
+ skip ();
+
+ virtual std::size_t
+ position ();
+
+ private:
+ std::size_t start_position_;
+ const std::vector<std::string>& v_;
+ std::size_t i_;
+ };
+
+ class argv_file_scanner: public argv_scanner
+ {
+ public:
+ argv_file_scanner (int& argc,
+ char** argv,
+ const std::string& option,
+ bool erase = false,
+ std::size_t start_position = 0);
+
+ argv_file_scanner (int start,
+ int& argc,
+ char** argv,
+ const std::string& option,
+ bool erase = false,
+ std::size_t start_position = 0);
+
+ argv_file_scanner (const std::string& file,
+ const std::string& option,
+ std::size_t start_position = 0);
+
+ struct option_info
+ {
+ // If search_func is not NULL, it is called, with the arg
+ // value as the second argument, to locate the options file.
+ // If it returns an empty string, then the file is ignored.
+ //
+ const char* option;
+ std::string (*search_func) (const char*, void* arg);
+ void* arg;
+ };
+
+ argv_file_scanner (int& argc,
+ char** argv,
+ const option_info* options,
+ std::size_t options_count,
+ bool erase = false,
+ std::size_t start_position = 0);
+
+ argv_file_scanner (int start,
+ int& argc,
+ char** argv,
+ const option_info* options,
+ std::size_t options_count,
+ bool erase = false,
+ std::size_t start_position = 0);
+
+ argv_file_scanner (const std::string& file,
+ const option_info* options = 0,
+ std::size_t options_count = 0,
+ std::size_t start_position = 0);
+
+ virtual bool
+ more ();
+
+ virtual const char*
+ peek ();
+
+ virtual const char*
+ next ();
+
+ virtual void
+ skip ();
+
+ virtual std::size_t
+ position ();
+
+ // Return the file path if the peeked at argument came from a file and
+ // the empty string otherwise. The reference is guaranteed to be valid
+ // till the end of the scanner lifetime.
+ //
+ const std::string&
+ peek_file ();
+
+ // Return the 1-based line number if the peeked at argument came from
+ // a file and zero otherwise.
+ //
+ std::size_t
+ peek_line ();
+
+ private:
+ const option_info*
+ find (const char*) const;
+
+ void
+ load (const std::string& file);
+
+ typedef argv_scanner base;
+
+ const std::string option_;
+ option_info option_info_;
+ const option_info* options_;
+ std::size_t options_count_;
+
+ struct arg
+ {
+ std::string value;
+ const std::string* file;
+ std::size_t line;
+ };
+
+ std::deque<arg> args_;
+ std::list<std::string> files_;
+
+ // Circular buffer of two arguments.
+ //
+ std::string hold_[2];
+ std::size_t i_;
+
+ bool skip_;
+
+ static int zero_argc_;
+ static std::string empty_string_;
+ };
+
+ class group_scanner: public scanner
+ {
+ public:
+ group_scanner (scanner&);
+
+ virtual bool
+ more ();
+
+ virtual const char*
+ peek ();
+
+ virtual const char*
+ next ();
+
+ virtual void
+ skip ();
+
+ virtual std::size_t
+ position ();
+
+ // The group is only available after the call to next()
+ // (and skip() -- in case one needs to make sure the group
+ // was empty, or some such) and is only valid (and must be
+ // handled) until the next call to any of the scanner
+ // functions (including more()).
+ //
+ // Note also that argument positions within each group start
+ // from 0.
+ //
+ scanner&
+ group ();
+
+ // Escape an argument that is a group separator. Return the
+ // passed string if no escaping is required.
+ //
+ static const char*
+ escape (const char*);
+
+ private:
+ enum state
+ {
+ peeked, // Argument peeked at with peek().
+ scanned, // Argument scanned with next().
+ skipped, // Argument skipped with skip()/initial.
+ };
+
+ enum separator
+ {
+ none,
+ open, // {
+ close, // }
+ open_plus, // +{
+ close_plus // }+
+ };
+
+ static separator
+ sense (const char*);
+
+ // Scan the leading groups, the next argument/argument pack,
+ // and the trailing groups.
+ //
+ void
+ scan_group ();
+
+ scanner& scan_;
+ state state_;
+
+ // Circular buffer of two arguments.
+ //
+ std::vector<std::string> arg_[2];
+ std::size_t i_, j_, pos_;
+
+ std::vector<std::string> group_;
+ vector_scanner group_scan_;
+ };
+
+ typedef std::vector<std::string> option_names;
+
+ class option
+ {
+ public:
+
+ const std::string&
+ name () const;
+
+ const option_names&
+ aliases () const;
+
+ bool
+ flag () const;
+
+ const std::string&
+ default_value () const;
+
+ public:option ();
+ option (const std::string& name,
+ const option_names& aliases,
+ bool flag,
+ const std::string& default_value);
+
+ private:
+ std::string name_;
+ option_names aliases_;
+ bool flag_;
+ std::string default_value_;
+ };
+
+ class options: public std::vector<option>
+ {
+ public:
+ typedef std::vector<option> container_type;
+
+ container_type::const_iterator
+ find (const std::string& name) const;
+
+ void
+ push_back (const option&);
+ private:
+ typedef std::map<std::string, container_type::size_type> map_type;
+ map_type map_;
+ };
+
+ template <typename X>
+ struct parser;
+ }
+}
+
+#include <bdep/types.hxx>
+
+#include <bdep/options-types.hxx>
+
+namespace bdep
+{
+ class common_options
+ {
+ public:
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const common_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ v () const;
+
+ bool&
+ v ();
+
+ void
+ v (const bool&);
+
+ const bool&
+ V () const;
+
+ bool&
+ V ();
+
+ void
+ V (const bool&);
+
+ const bool&
+ quiet () const;
+
+ bool&
+ quiet ();
+
+ void
+ quiet (const bool&);
+
+ const uint16_t&
+ verbose () const;
+
+ uint16_t&
+ verbose ();
+
+ void
+ verbose (const uint16_t&);
+
+ bool
+ verbose_specified () const;
+
+ void
+ verbose_specified (bool);
+
+ const bdep::stdout_format&
+ stdout_format () const;
+
+ bdep::stdout_format&
+ stdout_format ();
+
+ void
+ stdout_format (const bdep::stdout_format&);
+
+ bool
+ stdout_format_specified () const;
+
+ void
+ stdout_format_specified (bool);
+
+ const size_t&
+ jobs () const;
+
+ size_t&
+ jobs ();
+
+ void
+ jobs (const size_t&);
+
+ bool
+ jobs_specified () const;
+
+ void
+ jobs_specified (bool);
+
+ const bool&
+ progress () const;
+
+ bool&
+ progress ();
+
+ void
+ progress (const bool&);
+
+ const bool&
+ no_progress () const;
+
+ bool&
+ no_progress ();
+
+ void
+ no_progress (const bool&);
+
+ const bool&
+ diag_color () const;
+
+ bool&
+ diag_color ();
+
+ void
+ diag_color (const bool&);
+
+ const bool&
+ no_diag_color () const;
+
+ bool&
+ no_diag_color ();
+
+ void
+ no_diag_color (const bool&);
+
+ const path&
+ bpkg () const;
+
+ path&
+ bpkg ();
+
+ void
+ bpkg (const path&);
+
+ bool
+ bpkg_specified () const;
+
+ void
+ bpkg_specified (bool);
+
+ const strings&
+ bpkg_option () const;
+
+ strings&
+ bpkg_option ();
+
+ void
+ bpkg_option (const strings&);
+
+ bool
+ bpkg_option_specified () const;
+
+ void
+ bpkg_option_specified (bool);
+
+ const path&
+ build () const;
+
+ path&
+ build ();
+
+ void
+ build (const path&);
+
+ bool
+ build_specified () const;
+
+ void
+ build_specified (bool);
+
+ const strings&
+ build_option () const;
+
+ strings&
+ build_option ();
+
+ void
+ build_option (const strings&);
+
+ bool
+ build_option_specified () const;
+
+ void
+ build_option_specified (bool);
+
+ const path&
+ curl () const;
+
+ path&
+ curl ();
+
+ void
+ curl (const path&);
+
+ bool
+ curl_specified () const;
+
+ void
+ curl_specified (bool);
+
+ const strings&
+ curl_option () const;
+
+ strings&
+ curl_option ();
+
+ void
+ curl_option (const strings&);
+
+ bool
+ curl_option_specified () const;
+
+ void
+ curl_option_specified (bool);
+
+ const string&
+ pager () const;
+
+ string&
+ pager ();
+
+ void
+ pager (const string&);
+
+ bool
+ pager_specified () const;
+
+ void
+ pager_specified (bool);
+
+ const strings&
+ pager_option () const;
+
+ strings&
+ pager_option ();
+
+ void
+ pager_option (const strings&);
+
+ bool
+ pager_option_specified () const;
+
+ void
+ pager_option_specified (bool);
+
+ const string&
+ options_file () const;
+
+ string&
+ options_file ();
+
+ void
+ options_file (const string&);
+
+ bool
+ options_file_specified () const;
+
+ void
+ options_file_specified (bool);
+
+ const dir_path&
+ default_options () const;
+
+ dir_path&
+ default_options ();
+
+ void
+ default_options (const dir_path&);
+
+ bool
+ default_options_specified () const;
+
+ void
+ default_options_specified (bool);
+
+ const bool&
+ no_default_options () const;
+
+ bool&
+ no_default_options ();
+
+ void
+ no_default_options (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ static ::bdep::cli::usage_para
+ print_long_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ common_options ();
+
+ friend struct _cli_common_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ public:
+ bool v_;
+ bool V_;
+ bool quiet_;
+ uint16_t verbose_;
+ bool verbose_specified_;
+ bdep::stdout_format stdout_format_;
+ bool stdout_format_specified_;
+ size_t jobs_;
+ bool jobs_specified_;
+ bool progress_;
+ bool no_progress_;
+ bool diag_color_;
+ bool no_diag_color_;
+ path bpkg_;
+ bool bpkg_specified_;
+ strings bpkg_option_;
+ bool bpkg_option_specified_;
+ path build_;
+ bool build_specified_;
+ strings build_option_;
+ bool build_option_specified_;
+ path curl_;
+ bool curl_specified_;
+ strings curl_option_;
+ bool curl_option_specified_;
+ string pager_;
+ bool pager_specified_;
+ strings pager_option_;
+ bool pager_option_specified_;
+ string options_file_;
+ bool options_file_specified_;
+ dir_path default_options_;
+ bool default_options_specified_;
+ bool no_default_options_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_common_options_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ ::bdep::cli::usage_para
+ print_bdep_common_options_long_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/common-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_COMMON_OPTIONS_HXX
diff --git a/bdep/common-options.ixx b/bdep/common-options.ixx
new file mode 100644
index 0000000..934feb5
--- /dev/null
+++ b/bdep/common-options.ixx
@@ -0,0 +1,989 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <cassert>
+
+namespace bdep
+{
+ namespace cli
+ {
+ // usage_para
+ //
+ inline usage_para::
+ usage_para (value v)
+ : v_ (v)
+ {
+ }
+
+ // unknown_mode
+ //
+ inline unknown_mode::
+ unknown_mode (value v)
+ : v_ (v)
+ {
+ }
+
+ // exception
+ //
+ inline ::std::ostream&
+ operator<< (::std::ostream& os, const exception& e)
+ {
+ e.print (os);
+ return os;
+ }
+
+ // unknown_option
+ //
+ inline unknown_option::
+ unknown_option (const std::string& option)
+ : option_ (option)
+ {
+ }
+
+ inline const std::string& unknown_option::
+ option () const
+ {
+ return option_;
+ }
+
+ // unknown_argument
+ //
+ inline unknown_argument::
+ unknown_argument (const std::string& argument)
+ : argument_ (argument)
+ {
+ }
+
+ inline const std::string& unknown_argument::
+ argument () const
+ {
+ return argument_;
+ }
+
+ // missing_value
+ //
+ inline missing_value::
+ missing_value (const std::string& option)
+ : option_ (option)
+ {
+ }
+
+ inline const std::string& missing_value::
+ option () const
+ {
+ return option_;
+ }
+
+ // invalid_value
+ //
+ inline invalid_value::
+ invalid_value (const std::string& option,
+ const std::string& value,
+ const std::string& message)
+ : option_ (option),
+ value_ (value),
+ message_ (message)
+ {
+ }
+
+ inline const std::string& invalid_value::
+ option () const
+ {
+ return option_;
+ }
+
+ inline const std::string& invalid_value::
+ value () const
+ {
+ return value_;
+ }
+
+ inline const std::string& invalid_value::
+ message () const
+ {
+ return message_;
+ }
+
+ // file_io_failure
+ //
+ inline file_io_failure::
+ file_io_failure (const std::string& file)
+ : file_ (file)
+ {
+ }
+
+ inline const std::string& file_io_failure::
+ file () const
+ {
+ return file_;
+ }
+
+ // unmatched_quote
+ //
+ inline unmatched_quote::
+ unmatched_quote (const std::string& argument)
+ : argument_ (argument)
+ {
+ }
+
+ inline const std::string& unmatched_quote::
+ argument () const
+ {
+ return argument_;
+ }
+
+ // unexpected_group
+ //
+ inline unexpected_group::
+ unexpected_group (const std::string& argument,
+ const std::string& group)
+ : argument_ (argument), group_ (group)
+ {
+ }
+
+ inline const std::string& unexpected_group::
+ argument () const
+ {
+ return argument_;
+ }
+
+ inline const std::string& unexpected_group::
+ group () const
+ {
+ return group_;
+ }
+
+ // group_separator
+ //
+ inline group_separator::
+ group_separator (const std::string& encountered,
+ const std::string& expected)
+ : encountered_ (encountered), expected_ (expected)
+ {
+ }
+
+ inline const std::string& group_separator::
+ encountered () const
+ {
+ return encountered_;
+ }
+
+ inline const std::string& group_separator::
+ expected () const
+ {
+ return expected_;
+ }
+
+ // argv_scanner
+ //
+ inline argv_scanner::
+ argv_scanner (int& argc,
+ char** argv,
+ bool erase,
+ std::size_t sp)
+ : start_position_ (sp + 1),
+ i_ (1),
+ argc_ (argc),
+ argv_ (argv),
+ erase_ (erase)
+ {
+ }
+
+ inline argv_scanner::
+ argv_scanner (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ std::size_t sp)
+ : start_position_ (sp + static_cast<std::size_t> (start)),
+ i_ (start),
+ argc_ (argc),
+ argv_ (argv),
+ erase_ (erase)
+ {
+ }
+
+ inline int argv_scanner::
+ end () const
+ {
+ return i_;
+ }
+
+ // vector_scanner
+ //
+ inline vector_scanner::
+ vector_scanner (const std::vector<std::string>& v,
+ std::size_t i,
+ std::size_t sp)
+ : start_position_ (sp), v_ (v), i_ (i)
+ {
+ }
+
+ inline std::size_t vector_scanner::
+ end () const
+ {
+ return i_;
+ }
+
+ inline void vector_scanner::
+ reset (std::size_t i, std::size_t sp)
+ {
+ i_ = i;
+ start_position_ = sp;
+ }
+
+ // argv_file_scanner
+ //
+ inline argv_file_scanner::
+ argv_file_scanner (int& argc,
+ char** argv,
+ const std::string& option,
+ bool erase,
+ std::size_t sp)
+ : argv_scanner (argc, argv, erase, sp),
+ option_ (option),
+ options_ (&option_info_),
+ options_count_ (1),
+ i_ (1),
+ skip_ (false)
+ {
+ option_info_.option = option_.c_str ();
+ option_info_.search_func = 0;
+ }
+
+ inline argv_file_scanner::
+ argv_file_scanner (int start,
+ int& argc,
+ char** argv,
+ const std::string& option,
+ bool erase,
+ std::size_t sp)
+ : argv_scanner (start, argc, argv, erase, sp),
+ option_ (option),
+ options_ (&option_info_),
+ options_count_ (1),
+ i_ (1),
+ skip_ (false)
+ {
+ option_info_.option = option_.c_str ();
+ option_info_.search_func = 0;
+ }
+
+ inline argv_file_scanner::
+ argv_file_scanner (const std::string& file,
+ const std::string& option,
+ std::size_t sp)
+ : argv_scanner (0, zero_argc_, 0, sp),
+ option_ (option),
+ options_ (&option_info_),
+ options_count_ (1),
+ i_ (1),
+ skip_ (false)
+ {
+ option_info_.option = option_.c_str ();
+ option_info_.search_func = 0;
+
+ load (file);
+ }
+
+ inline argv_file_scanner::
+ argv_file_scanner (int& argc,
+ char** argv,
+ const option_info* options,
+ std::size_t options_count,
+ bool erase,
+ std::size_t sp)
+ : argv_scanner (argc, argv, erase, sp),
+ options_ (options),
+ options_count_ (options_count),
+ i_ (1),
+ skip_ (false)
+ {
+ }
+
+ inline argv_file_scanner::
+ argv_file_scanner (int start,
+ int& argc,
+ char** argv,
+ const option_info* options,
+ std::size_t options_count,
+ bool erase,
+ std::size_t sp)
+ : argv_scanner (start, argc, argv, erase, sp),
+ options_ (options),
+ options_count_ (options_count),
+ i_ (1),
+ skip_ (false)
+ {
+ }
+
+ inline argv_file_scanner::
+ argv_file_scanner (const std::string& file,
+ const option_info* options,
+ std::size_t options_count,
+ std::size_t sp)
+ : argv_scanner (0, zero_argc_, 0, sp),
+ options_ (options),
+ options_count_ (options_count),
+ i_ (1),
+ skip_ (false)
+ {
+ load (file);
+ }
+
+ // group_scanner
+ //
+ inline group_scanner::
+ group_scanner (scanner& s)
+ : scan_ (s), state_ (skipped), i_ (1), j_ (0), group_scan_ (group_)
+ {
+ }
+
+ inline scanner& group_scanner::
+ group ()
+ {
+ assert (state_ == scanned || state_ == skipped);
+ return group_scan_;
+ }
+
+ inline const char* group_scanner::
+ escape (const char* a)
+ {
+ switch (sense (a))
+ {
+ case separator::none: break;
+ case separator::open: return "\\{";
+ case separator::close: return "\\}";
+ case separator::open_plus: return "\\+{";
+ case separator::close_plus: return "\\}+";
+ }
+
+ return a;
+ }
+
+ inline group_scanner::separator group_scanner::
+ sense (const char* s)
+ {
+ switch (s[0])
+ {
+ case '{': return s[1] == '\0' ? open : none;
+ case '}':
+ {
+ switch (s[1])
+ {
+ case '+': return s[2] == '\0' ? close_plus : none;
+ default: return s[1] == '\0' ? close : none;
+ }
+ }
+ case '+':
+ {
+ switch (s[1])
+ {
+ case '{': return s[2] == '\0' ? open_plus : none;
+ default: return none;
+ }
+ }
+ }
+
+ return none;
+ }
+
+ inline const std::string& option::
+ name () const
+ {
+ return name_;
+ }
+
+ inline const option_names& option::
+ aliases () const
+ {
+ return aliases_;
+ }
+
+ inline bool option::
+ flag () const
+ {
+ return flag_;
+ }
+
+ inline const std::string& option::
+ default_value () const
+ {
+ return default_value_;
+ }
+
+ inline option::
+ option ()
+ {
+ }
+
+ inline option::
+ option (const std::string& n,
+ const option_names& a,
+ bool f,
+ const std::string& dv)
+ : name_ (n), aliases_ (a), flag_ (f), default_value_ (dv)
+ {
+ }
+
+ inline options::container_type::const_iterator options::
+ find (const std::string& name) const
+ {
+ map_type::const_iterator i (map_.find (name));
+ return i != map_.end () ? begin () + i->second : end ();
+ }
+ }
+}
+
+namespace bdep
+{
+ // common_options
+ //
+
+ inline const bool& common_options::
+ v () const
+ {
+ return this->v_;
+ }
+
+ inline bool& common_options::
+ v ()
+ {
+ return this->v_;
+ }
+
+ inline void common_options::
+ v (const bool& x)
+ {
+ this->v_ = x;
+ }
+
+ inline const bool& common_options::
+ V () const
+ {
+ return this->V_;
+ }
+
+ inline bool& common_options::
+ V ()
+ {
+ return this->V_;
+ }
+
+ inline void common_options::
+ V (const bool& x)
+ {
+ this->V_ = x;
+ }
+
+ inline const bool& common_options::
+ quiet () const
+ {
+ return this->quiet_;
+ }
+
+ inline bool& common_options::
+ quiet ()
+ {
+ return this->quiet_;
+ }
+
+ inline void common_options::
+ quiet (const bool& x)
+ {
+ this->quiet_ = x;
+ }
+
+ inline const uint16_t& common_options::
+ verbose () const
+ {
+ return this->verbose_;
+ }
+
+ inline uint16_t& common_options::
+ verbose ()
+ {
+ return this->verbose_;
+ }
+
+ inline void common_options::
+ verbose (const uint16_t& x)
+ {
+ this->verbose_ = x;
+ }
+
+ inline bool common_options::
+ verbose_specified () const
+ {
+ return this->verbose_specified_;
+ }
+
+ inline void common_options::
+ verbose_specified (bool x)
+ {
+ this->verbose_specified_ = x;
+ }
+
+ inline const bdep::stdout_format& common_options::
+ stdout_format () const
+ {
+ return this->stdout_format_;
+ }
+
+ inline bdep::stdout_format& common_options::
+ stdout_format ()
+ {
+ return this->stdout_format_;
+ }
+
+ inline void common_options::
+ stdout_format (const bdep::stdout_format& x)
+ {
+ this->stdout_format_ = x;
+ }
+
+ inline bool common_options::
+ stdout_format_specified () const
+ {
+ return this->stdout_format_specified_;
+ }
+
+ inline void common_options::
+ stdout_format_specified (bool x)
+ {
+ this->stdout_format_specified_ = x;
+ }
+
+ inline const size_t& common_options::
+ jobs () const
+ {
+ return this->jobs_;
+ }
+
+ inline size_t& common_options::
+ jobs ()
+ {
+ return this->jobs_;
+ }
+
+ inline void common_options::
+ jobs (const size_t& x)
+ {
+ this->jobs_ = x;
+ }
+
+ inline bool common_options::
+ jobs_specified () const
+ {
+ return this->jobs_specified_;
+ }
+
+ inline void common_options::
+ jobs_specified (bool x)
+ {
+ this->jobs_specified_ = x;
+ }
+
+ inline const bool& common_options::
+ progress () const
+ {
+ return this->progress_;
+ }
+
+ inline bool& common_options::
+ progress ()
+ {
+ return this->progress_;
+ }
+
+ inline void common_options::
+ progress (const bool& x)
+ {
+ this->progress_ = x;
+ }
+
+ inline const bool& common_options::
+ no_progress () const
+ {
+ return this->no_progress_;
+ }
+
+ inline bool& common_options::
+ no_progress ()
+ {
+ return this->no_progress_;
+ }
+
+ inline void common_options::
+ no_progress (const bool& x)
+ {
+ this->no_progress_ = x;
+ }
+
+ inline const bool& common_options::
+ diag_color () const
+ {
+ return this->diag_color_;
+ }
+
+ inline bool& common_options::
+ diag_color ()
+ {
+ return this->diag_color_;
+ }
+
+ inline void common_options::
+ diag_color (const bool& x)
+ {
+ this->diag_color_ = x;
+ }
+
+ inline const bool& common_options::
+ no_diag_color () const
+ {
+ return this->no_diag_color_;
+ }
+
+ inline bool& common_options::
+ no_diag_color ()
+ {
+ return this->no_diag_color_;
+ }
+
+ inline void common_options::
+ no_diag_color (const bool& x)
+ {
+ this->no_diag_color_ = x;
+ }
+
+ inline const path& common_options::
+ bpkg () const
+ {
+ return this->bpkg_;
+ }
+
+ inline path& common_options::
+ bpkg ()
+ {
+ return this->bpkg_;
+ }
+
+ inline void common_options::
+ bpkg (const path& x)
+ {
+ this->bpkg_ = x;
+ }
+
+ inline bool common_options::
+ bpkg_specified () const
+ {
+ return this->bpkg_specified_;
+ }
+
+ inline void common_options::
+ bpkg_specified (bool x)
+ {
+ this->bpkg_specified_ = x;
+ }
+
+ inline const strings& common_options::
+ bpkg_option () const
+ {
+ return this->bpkg_option_;
+ }
+
+ inline strings& common_options::
+ bpkg_option ()
+ {
+ return this->bpkg_option_;
+ }
+
+ inline void common_options::
+ bpkg_option (const strings& x)
+ {
+ this->bpkg_option_ = x;
+ }
+
+ inline bool common_options::
+ bpkg_option_specified () const
+ {
+ return this->bpkg_option_specified_;
+ }
+
+ inline void common_options::
+ bpkg_option_specified (bool x)
+ {
+ this->bpkg_option_specified_ = x;
+ }
+
+ inline const path& common_options::
+ build () const
+ {
+ return this->build_;
+ }
+
+ inline path& common_options::
+ build ()
+ {
+ return this->build_;
+ }
+
+ inline void common_options::
+ build (const path& x)
+ {
+ this->build_ = x;
+ }
+
+ inline bool common_options::
+ build_specified () const
+ {
+ return this->build_specified_;
+ }
+
+ inline void common_options::
+ build_specified (bool x)
+ {
+ this->build_specified_ = x;
+ }
+
+ inline const strings& common_options::
+ build_option () const
+ {
+ return this->build_option_;
+ }
+
+ inline strings& common_options::
+ build_option ()
+ {
+ return this->build_option_;
+ }
+
+ inline void common_options::
+ build_option (const strings& x)
+ {
+ this->build_option_ = x;
+ }
+
+ inline bool common_options::
+ build_option_specified () const
+ {
+ return this->build_option_specified_;
+ }
+
+ inline void common_options::
+ build_option_specified (bool x)
+ {
+ this->build_option_specified_ = x;
+ }
+
+ inline const path& common_options::
+ curl () const
+ {
+ return this->curl_;
+ }
+
+ inline path& common_options::
+ curl ()
+ {
+ return this->curl_;
+ }
+
+ inline void common_options::
+ curl (const path& x)
+ {
+ this->curl_ = x;
+ }
+
+ inline bool common_options::
+ curl_specified () const
+ {
+ return this->curl_specified_;
+ }
+
+ inline void common_options::
+ curl_specified (bool x)
+ {
+ this->curl_specified_ = x;
+ }
+
+ inline const strings& common_options::
+ curl_option () const
+ {
+ return this->curl_option_;
+ }
+
+ inline strings& common_options::
+ curl_option ()
+ {
+ return this->curl_option_;
+ }
+
+ inline void common_options::
+ curl_option (const strings& x)
+ {
+ this->curl_option_ = x;
+ }
+
+ inline bool common_options::
+ curl_option_specified () const
+ {
+ return this->curl_option_specified_;
+ }
+
+ inline void common_options::
+ curl_option_specified (bool x)
+ {
+ this->curl_option_specified_ = x;
+ }
+
+ inline const string& common_options::
+ pager () const
+ {
+ return this->pager_;
+ }
+
+ inline string& common_options::
+ pager ()
+ {
+ return this->pager_;
+ }
+
+ inline void common_options::
+ pager (const string& x)
+ {
+ this->pager_ = x;
+ }
+
+ inline bool common_options::
+ pager_specified () const
+ {
+ return this->pager_specified_;
+ }
+
+ inline void common_options::
+ pager_specified (bool x)
+ {
+ this->pager_specified_ = x;
+ }
+
+ inline const strings& common_options::
+ pager_option () const
+ {
+ return this->pager_option_;
+ }
+
+ inline strings& common_options::
+ pager_option ()
+ {
+ return this->pager_option_;
+ }
+
+ inline void common_options::
+ pager_option (const strings& x)
+ {
+ this->pager_option_ = x;
+ }
+
+ inline bool common_options::
+ pager_option_specified () const
+ {
+ return this->pager_option_specified_;
+ }
+
+ inline void common_options::
+ pager_option_specified (bool x)
+ {
+ this->pager_option_specified_ = x;
+ }
+
+ inline const string& common_options::
+ options_file () const
+ {
+ return this->options_file_;
+ }
+
+ inline string& common_options::
+ options_file ()
+ {
+ return this->options_file_;
+ }
+
+ inline void common_options::
+ options_file (const string& x)
+ {
+ this->options_file_ = x;
+ }
+
+ inline bool common_options::
+ options_file_specified () const
+ {
+ return this->options_file_specified_;
+ }
+
+ inline void common_options::
+ options_file_specified (bool x)
+ {
+ this->options_file_specified_ = x;
+ }
+
+ inline const dir_path& common_options::
+ default_options () const
+ {
+ return this->default_options_;
+ }
+
+ inline dir_path& common_options::
+ default_options ()
+ {
+ return this->default_options_;
+ }
+
+ inline void common_options::
+ default_options (const dir_path& x)
+ {
+ this->default_options_ = x;
+ }
+
+ inline bool common_options::
+ default_options_specified () const
+ {
+ return this->default_options_specified_;
+ }
+
+ inline void common_options::
+ default_options_specified (bool x)
+ {
+ this->default_options_specified_ = x;
+ }
+
+ inline const bool& common_options::
+ no_default_options () const
+ {
+ return this->no_default_options_;
+ }
+
+ inline bool& common_options::
+ no_default_options ()
+ {
+ return this->no_default_options_;
+ }
+
+ inline void common_options::
+ no_default_options (const bool& x)
+ {
+ this->no_default_options_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/config-options.cxx b/bdep/config-options.cxx
new file mode 100644
index 0000000..c63ee8e
--- /dev/null
+++ b/bdep/config-options.cxx
@@ -0,0 +1,1336 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/config-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_config_subcommands
+ //
+
+ cmd_config_subcommands::
+ cmd_config_subcommands ()
+ : add_ (),
+ create_ (),
+ link_ (),
+ unlink_ (),
+ list_ (),
+ move_ (),
+ rename_ (),
+ remove_ (),
+ set_ ()
+ {
+ }
+
+ bool cmd_config_subcommands::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_config_subcommands::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_config_subcommands::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_config_subcommands::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_config_subcommands::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_config_subcommands::
+ merge (const cmd_config_subcommands& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.add_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->add_, a.add_);
+ }
+
+ if (a.create_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->create_, a.create_);
+ }
+
+ if (a.link_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->link_, a.link_);
+ }
+
+ if (a.unlink_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->unlink_, a.unlink_);
+ }
+
+ if (a.list_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->list_, a.list_);
+ }
+
+ if (a.move_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->move_, a.move_);
+ }
+
+ if (a.rename_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->rename_, a.rename_);
+ }
+
+ if (a.remove_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->remove_, a.remove_);
+ }
+
+ if (a.set_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->set_, a.set_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_config_subcommands::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mCONFIG SUBCOMMANDS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1madd\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mcreate\033[0m" << ::std::endl
+ << " The \033[1madd\033[0m subcommand adds an existing \033[1mbpkg(1)\033[0m build configuration in" << ::std::endl
+ << " directory \033[4mcfg-dir\033[0m to the project's build configuration set. The \033[1mcreate\033[0m" << ::std::endl
+ << " subcommand creates a new configuration in directory \033[4mcfg-dir\033[0m by executing" << ::std::endl
+ << " the \033[1mbpkg-cfg-create(1)\033[0m command and passing to it \033[4mcfg-args\033[0m, if any. It then" << ::std::endl
+ << " proceeds as \033[1madd\033[0m by adding the new configuration to the project's build" << ::std::endl
+ << " configuration set." << ::std::endl
+ << ::std::endl
+ << " In both subcommands, if \033[4mcfg-name\033[0m is specified, then the added configuration" << ::std::endl
+ << " is given this name. Several \033[1mbdep\033[0m commands can use such names as a more" << ::std::endl
+ << " convenient way to specify build configurations (see" << ::std::endl
+ << " \033[1mbdep-projects-configs(1)\033[0m for details)." << ::std::endl
+ << ::std::endl
+ << " As a shortcut, if \033[4mcfg-name\033[0m is not specified and \033[4mcfg-dir\033[0m is a simple path" << ::std::endl
+ << " that starts with \033[1m@\033[0m, then it is treated as the name and the configuration" << ::std::endl
+ << " directory is assumed to be \033[4mprj-dir\033[0m\033[1m-\033[0m\033[4mcfg-name\033[0m\033[0m. Note that in case of create\033[0m," << ::std::endl
+ << " \033[4mcfg-dir\033[0m must be preceded with \033[1m--\033[0m (double dash) option to disambiguate it" << ::std::endl
+ << " from \033[1m@\033[0m\033[4mcfg-name\033[0m\033[0m. For example, assuming the project directory is \033[1mhello\033[0m:" << ::std::endl
+ << ::std::endl
+ << " $ bdep config add @clang # ../hello-clang" << ::std::endl
+ << " $ bdep config create -- @gcc cc config.cxx=g++ # ../hello-gcc" << ::std::endl
+ << ::std::endl
+ << " A configuration also has a type that is specified with the \033[1m--type\033[0m option" << ::std::endl
+ << " (or \033[1m--config-type\033[0m from \033[1mbdep-new(1)\033[0m). If the type is not specified" << ::std::endl
+ << " explicitly, then \033[1mtarget\033[0m is assumed. See \033[1mbpkg-cfg-create(1)\033[0m for background" << ::std::endl
+ << " on configuration types." << ::std::endl
+ << ::std::endl
+ << " Unless the \033[1m--no-default\033[0m option is specified, the first added or created" << ::std::endl
+ << " build configuration of each type is designated as the default. Several" << ::std::endl
+ << " \033[1mbdep\033[0m commands use such a configuration by default if no configuration was" << ::std::endl
+ << " specified explicitly (see \033[1mbdep-projects-configs(1)\033[0m for details). To make a" << ::std::endl
+ << " subsequently added configuration the default use the \033[1m--default\033[0m option. Note" << ::std::endl
+ << " also that in case of multiple default configurations any given package" << ::std::endl
+ << " within a project can only be initialized in one such configuration." << ::std::endl
+ << ::std::endl
+ << " The default build configuration of each type is also designated as" << ::std::endl
+ << " forwarded unless the \033[1m--no-forward\033[0m option is specified or another" << ::std::endl
+ << " configuration of this type is already designated as forwarded. When a" << ::std::endl
+ << " project is initialized in a forwarded build configuration, its source" << ::std::endl
+ << " directory is configured to forward to this configuration (see \033[1mb(1)\033[0m for" << ::std::endl
+ << " details on forwarded configurations). To designate a non-default" << ::std::endl
+ << " configuration as forwarded use the \033[1m--forward\033[0m option. Note also that it is" << ::std::endl
+ << " possible to have multiple forwarded configurations, however, any given" << ::std::endl
+ << " package within a project can only be initialized in one such configuration." << ::std::endl
+ << ::std::endl
+ << " Unless the \033[1m--no-auto-sync\033[0m option is specified, an added or created build" << ::std::endl
+ << " configuration will be automatically synchronized on every build system" << ::std::endl
+ << " invocation. Note that this flag affects the entire build configuration and" << ::std::endl
+ << " if multiple projects share the same configuration, then they must have a" << ::std::endl
+ << " consistent auto-synchronization setting." << ::std::endl
+ << "\033[1mlink\033[0m" << ::std::endl
+ << " The \033[1mlink\033[0m subcommand links the first specified build configuration with the" << ::std::endl
+ << " second by executing the \033[1mbpkg-cfg-link(1)\033[0m command. See \033[1mbpkg-cfg-create(1)\033[0m" << ::std::endl
+ << " for background on linked configurations." << ::std::endl
+ << "\033[1munlink\033[0m" << ::std::endl
+ << " The \033[1munlink\033[0m subcommand unlinks the first specified build configuration from" << ::std::endl
+ << " the second by executing the \033[1mbpkg-cfg-unlink(1)\033[0m command. See" << ::std::endl
+ << " \033[1mbpkg-cfg-create(1)\033[0m for background on linked configurations." << ::std::endl
+ << "\033[1mlist\033[0m" << ::std::endl
+ << " The \033[1mlist\033[0m subcommand prints the list of build configurations associated with" << ::std::endl
+ << " the project. Unless one or more configurations are specified explicitly," << ::std::endl
+ << " \033[1mlist\033[0m prints all the associate configurations. Note that the output is" << ::std::endl
+ << " written to \033[1mstdout\033[0m, not \033[1mstderr\033[0m." << ::std::endl
+ << ::std::endl
+ << " If the output format is \033[1mjson\033[0m (see the \033[1m--stdout-format\033[0m common option), then" << ::std::endl
+ << " the output is a JSON array of objects which are the serialized" << ::std::endl
+ << " representation of the following C++ \033[1mstruct\033[0m \033[1mconfiguration\033[0m:" << ::std::endl
+ << ::std::endl
+ << " struct package" << ::std::endl
+ << " {" << ::std::endl
+ << " string name;" << ::std::endl
+ << " };" << ::std::endl
+ << ::std::endl
+ << " struct configuration" << ::std::endl
+ << " {" << ::std::endl
+ << " uint64_t id;" << ::std::endl
+ << " string path;" << ::std::endl
+ << " optional<string> name;" << ::std::endl
+ << " string type;" << ::std::endl
+ << " bool default;" << ::std::endl
+ << " bool forward;" << ::std::endl
+ << " bool auto_sync;" << ::std::endl
+ << " vector<package> packages;" << ::std::endl
+ << " };" << ::std::endl
+ << ::std::endl
+ << " For example:" << ::std::endl
+ << ::std::endl
+ << " [" << ::std::endl
+ << " {" << ::std::endl
+ << " \"id\": 1," << ::std::endl
+ << " \"path\": \"/tmp/hello-gcc\"," << ::std::endl
+ << " \"name\": \"gcc\"," << ::std::endl
+ << " \"type\": \"target\"," << ::std::endl
+ << " \"default\": true," << ::std::endl
+ << " \"forward\": true," << ::std::endl
+ << " \"auto_sync\": true," << ::std::endl
+ << " \"packages\": [" << ::std::endl
+ << " {" << ::std::endl
+ << " \"name\": \"hello\"" << ::std::endl
+ << " }" << ::std::endl
+ << " ]" << ::std::endl
+ << " }" << ::std::endl
+ << " ]" << ::std::endl
+ << ::std::endl
+ << " See the JSON OUTPUT section in \033[1mbdep-common-options(1)\033[0m for details on the" << ::std::endl
+ << " overall properties of this format and the semantics of the \033[1mstruct\033[0m" << ::std::endl
+ << " serialization." << ::std::endl
+ << ::std::endl
+ << " The \033[1mid\033[0m member is a numeric configuration id that can be used to identify" << ::std::endl
+ << " the configuration instead of the name or path (see the \033[1m--config-id\033[0m option)." << ::std::endl
+ << " The \033[1mpath\033[0m member is an absolute path to the configuration directory. The" << ::std::endl
+ << " \033[1mpackages\033[0m member contains the array of packages belonging to this project" << ::std::endl
+ << " that have been initialized in this configuration. See the \033[1mcreate\033[0m subcommand" << ::std::endl
+ << " for the meaning of other members (\033[1mname\033[0m, \033[1mtype\033[0m, \033[1mdefault\033[0m, etc)." << ::std::endl
+ << "\033[1mmove\033[0m" << ::std::endl
+ << " The \033[1mmove\033[0m subcommand assigns the specified build configuration a new" << ::std::endl
+ << " directory. It is normally used after moving/renaming the configuration" << ::std::endl
+ << " directory. Note that an explicit \033[1mbdep-sync(1)\033[0m command is required for this" << ::std::endl
+ << " change to take effect. See \033[1mbdep-projects-configs(1)\033[0m for various ways to" << ::std::endl
+ << " specify a build configuration." << ::std::endl
+ << "\033[1mrename\033[0m" << ::std::endl
+ << " The \033[1mrename\033[0m subcommand gives the specified build configuration a new name." << ::std::endl
+ << " See \033[1mbdep-projects-configs(1)\033[0m for various ways to specify a build" << ::std::endl
+ << " configuration." << ::std::endl
+ << "\033[1mremove\033[0m" << ::std::endl
+ << " The \033[1mremove\033[0m subcommand removes one or more build configurations from the" << ::std::endl
+ << " project's build configuration set. Note that only configurations that have" << ::std::endl
+ << " no initialized packages can be removed. See \033[1mbdep-projects-configs(1)\033[0m for" << ::std::endl
+ << " various ways to specify build configurations." << ::std::endl
+ << "\033[1mset\033[0m" << ::std::endl
+ << " The \033[1mset\033[0m subcommand modifies various properties of one or more build" << ::std::endl
+ << " configurations associated with the project. See \033[1mbdep-projects-configs(1)\033[0m" << ::std::endl
+ << " for various ways to specify build configurations." << ::std::endl
+ << ::std::endl
+ << " The properties that can be modified include the default (\033[1m--\033[0m[\033[1mno-\033[0m]\033[1mdefault\033[0m\033[0m)," << ::std::endl
+ << " forward (\033[1m--\033[0m[\033[1mno-\033[0m]\033[1mforward\033[0m\033[0m), and auto-synchronization (\033[1m--\033[0m[\033[1mno-\033[0m]\033[1mauto-sync\033[0m\033[0m)" << ::std::endl
+ << " flags. Note that changing any of these flags requires an explicit" << ::std::endl
+ << " \033[1mbdep-sync(1)\033[0m command to take effect." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+
+ struct _cli_cmd_config_subcommands_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_config_subcommands_desc_type ()
+ {
+ ::bdep::cmd_config_subcommands::fill (*this);
+ }
+ };
+
+ void cmd_config_subcommands::
+ fill (::bdep::cli::options& os)
+ {
+ // add
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("add", a, true, dv);
+ os.push_back (o);
+ }
+
+ // create
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("create", a, true, dv);
+ os.push_back (o);
+ }
+
+ // link
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("link", a, true, dv);
+ os.push_back (o);
+ }
+
+ // unlink
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("unlink", a, true, dv);
+ os.push_back (o);
+ }
+
+ // list
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("list", a, true, dv);
+ os.push_back (o);
+ }
+
+ // move
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("move", a, true, dv);
+ os.push_back (o);
+ }
+
+ // rename
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("rename", a, true, dv);
+ os.push_back (o);
+ }
+
+ // remove
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("remove", a, true, dv);
+ os.push_back (o);
+ }
+
+ // set
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("set", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_config_subcommands::
+ description ()
+ {
+ static _cli_cmd_config_subcommands_desc_type _cli_cmd_config_subcommands_desc_;
+ return _cli_cmd_config_subcommands_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_config_subcommands&, ::bdep::cli::scanner&)>
+ _cli_cmd_config_subcommands_map;
+
+ static _cli_cmd_config_subcommands_map _cli_cmd_config_subcommands_map_;
+
+ struct _cli_cmd_config_subcommands_map_init
+ {
+ _cli_cmd_config_subcommands_map_init ()
+ {
+ _cli_cmd_config_subcommands_map_["add"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::add_ >;
+ _cli_cmd_config_subcommands_map_["create"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::create_ >;
+ _cli_cmd_config_subcommands_map_["link"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::link_ >;
+ _cli_cmd_config_subcommands_map_["unlink"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::unlink_ >;
+ _cli_cmd_config_subcommands_map_["list"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::list_ >;
+ _cli_cmd_config_subcommands_map_["move"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::move_ >;
+ _cli_cmd_config_subcommands_map_["rename"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::rename_ >;
+ _cli_cmd_config_subcommands_map_["remove"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::remove_ >;
+ _cli_cmd_config_subcommands_map_["set"] =
+ &::bdep::cli::thunk< cmd_config_subcommands, &cmd_config_subcommands::set_ >;
+ }
+ };
+
+ static _cli_cmd_config_subcommands_map_init _cli_cmd_config_subcommands_map_init_;
+
+ bool cmd_config_subcommands::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_config_subcommands_map::const_iterator i (_cli_cmd_config_subcommands_map_.find (o));
+
+ if (i != _cli_cmd_config_subcommands_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_config_subcommands::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_config_options
+ //
+
+ cmd_config_options::
+ cmd_config_options ()
+ {
+ }
+
+ bool cmd_config_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_config_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_config_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_config_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_config_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_config_options::
+ merge (const cmd_config_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // configuration_add_options base
+ //
+ ::bdep::configuration_add_options::merge (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+ }
+
+ ::bdep::cli::usage_para cmd_config_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mCONFIG OPTIONS\033[0m" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ // configuration_add_options base
+ //
+ p = ::bdep::configuration_add_options::print_usage (os, p);
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_config_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_config_options_desc_type ()
+ {
+ ::bdep::cmd_config_options::fill (*this);
+ }
+ };
+
+ void cmd_config_options::
+ fill (::bdep::cli::options& os)
+ {
+ // configuration_add_options base
+ //
+ ::bdep::configuration_add_options::fill (os);
+
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+ }
+
+ const ::bdep::cli::options& cmd_config_options::
+ description ()
+ {
+ static _cli_cmd_config_options_desc_type _cli_cmd_config_options_desc_;
+ return _cli_cmd_config_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_config_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_config_options_map;
+
+ static _cli_cmd_config_options_map _cli_cmd_config_options_map_;
+
+ struct _cli_cmd_config_options_map_init
+ {
+ _cli_cmd_config_options_map_init ()
+ {
+ }
+ };
+
+ static _cli_cmd_config_options_map_init _cli_cmd_config_options_map_init_;
+
+ bool cmd_config_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_config_options_map::const_iterator i (_cli_cmd_config_options_map_.find (o));
+
+ if (i != _cli_cmd_config_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // configuration_add_options base
+ //
+ if (::bdep::configuration_add_options::_parse (o, s))
+ return true;
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_config_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_config_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep config add\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] [\033[1m@\033[0m\033[4mcfg-name\033[0m] \033[4mcfg-dir\033[0m" << ::std::endl
+ << "\033[1mbdep config create\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] [\033[1m@\033[0m\033[4mcfg-name\033[0m] \033[4mcfg-dir\033[0m [\033[4mcfg-args\033[0m]" << ::std::endl
+ << "\033[1mbdep config link\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] \033[4mcfg-spec\033[0m \033[4mcfg-spec\033[0m" << ::std::endl
+ << "\033[1mbdep config unlink\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] \033[4mcfg-spec\033[0m \033[4mcfg-spec\033[0m" << ::std::endl
+ << "\033[1mbdep config list\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] [\033[4mcfg-spec\033[0m...]" << ::std::endl
+ << "\033[1mbdep config move\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] \033[4mcfg-spec\033[0m \033[4mcfg-dir\033[0m" << ::std::endl
+ << "\033[1mbdep config rename\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] \033[4mcfg-spec\033[0m \033[4mcfg-name\033[0m" << ::std::endl
+ << "\033[1mbdep config remove\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] \033[4mcfg-spec\033[0m... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[1mbdep config set\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] \033[4mcfg-spec\033[0m... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << " [\033[1m--\033[0m[\033[1mno-\033[0m]\033[1mdefault\033[0m]" << ::std::endl
+ << " [\033[1m--\033[0m[\033[1mno-\033[0m]\033[1mforward\033[0m]" << ::std::endl
+ << " [\033[1m--\033[0m[\033[1mno-\033[0m]\033[1mauto-sync\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = \033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m" << ::std::endl
+ << "\033[4mcfg-args\033[0m = [\033[1m--\033[0m [\033[4mbpkg-options\033[0m]] [\033[1m--existing\033[0m|\033[1m-e\033[0m | (\033[4mmodule\033[0m | \033[4mcfg-var\033[0m)...]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mconfig\033[0m command provides the following subcommands for managing project's" << ::std::endl
+ << "build configurations. If no project directory is specified, then the current" << ::std::endl
+ << "working directory is assumed." << ::std::endl;
+
+ p = ::bdep::cmd_config_subcommands::print_usage (os, ::bdep::cli::usage_para::text);
+
+ p = ::bdep::cmd_config_options::print_usage (os, p);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mconfig\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-config.options" << ::std::endl
+ << "bdep-config-add.options # if the create subcommand" << ::std::endl
+ << "bdep-config-<subcommand>.options # (subcommand-dependent)" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mconfig\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl
+ << "--wipe" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/config-options.hxx b/bdep/config-options.hxx
new file mode 100644
index 0000000..5613dbf
--- /dev/null
+++ b/bdep/config-options.hxx
@@ -0,0 +1,293 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_CONFIG_OPTIONS_HXX
+#define BDEP_CONFIG_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_config_subcommands
+ {
+ public:
+ cmd_config_subcommands ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_config_subcommands&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ add () const;
+
+ bool&
+ add ();
+
+ void
+ add (const bool&);
+
+ const bool&
+ create () const;
+
+ bool&
+ create ();
+
+ void
+ create (const bool&);
+
+ const bool&
+ link () const;
+
+ bool&
+ link ();
+
+ void
+ link (const bool&);
+
+ const bool&
+ unlink () const;
+
+ bool&
+ unlink ();
+
+ void
+ unlink (const bool&);
+
+ const bool&
+ list () const;
+
+ bool&
+ list ();
+
+ void
+ list (const bool&);
+
+ const bool&
+ move () const;
+
+ bool&
+ move ();
+
+ void
+ move (const bool&);
+
+ const bool&
+ rename () const;
+
+ bool&
+ rename ();
+
+ void
+ rename (const bool&);
+
+ const bool&
+ remove () const;
+
+ bool&
+ remove ();
+
+ void
+ remove (const bool&);
+
+ const bool&
+ set () const;
+
+ bool&
+ set ();
+
+ void
+ set (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_config_subcommands_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool add_;
+ bool create_;
+ bool link_;
+ bool unlink_;
+ bool list_;
+ bool move_;
+ bool rename_;
+ bool remove_;
+ bool set_;
+ };
+
+ class cmd_config_options: public ::bdep::configuration_add_options,
+ public ::bdep::project_options
+ {
+ public:
+ cmd_config_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_config_options&);
+
+ // Option accessors and modifiers.
+ //
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_config_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_config_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/config-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_CONFIG_OPTIONS_HXX
diff --git a/bdep/config-options.ixx b/bdep/config-options.ixx
new file mode 100644
index 0000000..b0b615d
--- /dev/null
+++ b/bdep/config-options.ixx
@@ -0,0 +1,186 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_config_subcommands
+ //
+
+ inline const bool& cmd_config_subcommands::
+ add () const
+ {
+ return this->add_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ add ()
+ {
+ return this->add_;
+ }
+
+ inline void cmd_config_subcommands::
+ add (const bool& x)
+ {
+ this->add_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ create () const
+ {
+ return this->create_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ create ()
+ {
+ return this->create_;
+ }
+
+ inline void cmd_config_subcommands::
+ create (const bool& x)
+ {
+ this->create_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ link () const
+ {
+ return this->link_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ link ()
+ {
+ return this->link_;
+ }
+
+ inline void cmd_config_subcommands::
+ link (const bool& x)
+ {
+ this->link_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ unlink () const
+ {
+ return this->unlink_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ unlink ()
+ {
+ return this->unlink_;
+ }
+
+ inline void cmd_config_subcommands::
+ unlink (const bool& x)
+ {
+ this->unlink_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ list () const
+ {
+ return this->list_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ list ()
+ {
+ return this->list_;
+ }
+
+ inline void cmd_config_subcommands::
+ list (const bool& x)
+ {
+ this->list_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ move () const
+ {
+ return this->move_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ move ()
+ {
+ return this->move_;
+ }
+
+ inline void cmd_config_subcommands::
+ move (const bool& x)
+ {
+ this->move_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ rename () const
+ {
+ return this->rename_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ rename ()
+ {
+ return this->rename_;
+ }
+
+ inline void cmd_config_subcommands::
+ rename (const bool& x)
+ {
+ this->rename_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ remove () const
+ {
+ return this->remove_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ remove ()
+ {
+ return this->remove_;
+ }
+
+ inline void cmd_config_subcommands::
+ remove (const bool& x)
+ {
+ this->remove_ = x;
+ }
+
+ inline const bool& cmd_config_subcommands::
+ set () const
+ {
+ return this->set_;
+ }
+
+ inline bool& cmd_config_subcommands::
+ set ()
+ {
+ return this->set_;
+ }
+
+ inline void cmd_config_subcommands::
+ set (const bool& x)
+ {
+ this->set_ = x;
+ }
+
+ // cmd_config_options
+ //
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/database-views-odb.cxx b/bdep/database-views-odb.cxx
new file mode 100644
index 0000000..1f1ec4f
--- /dev/null
+++ b/bdep/database-views-odb.cxx
@@ -0,0 +1,233 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#include <odb/pre.hxx>
+
+#include <bdep/database-views-odb.hxx>
+
+#include <cassert>
+#include <cstring> // std::memcpy
+
+
+#include <odb/sqlite/traits.hxx>
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+#include <odb/sqlite/connection.hxx>
+#include <odb/sqlite/statement.hxx>
+#include <odb/sqlite/statement-cache.hxx>
+#include <odb/sqlite/view-statements.hxx>
+#include <odb/sqlite/container-statements.hxx>
+#include <odb/sqlite/exceptions.hxx>
+#include <odb/sqlite/view-result.hxx>
+
+namespace odb
+{
+ // sqlite_master
+ //
+
+ bool access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // type
+ //
+ if (t[0UL])
+ {
+ i.type_value.capacity (i.type_size);
+ grew = true;
+ }
+
+ // name
+ //
+ if (t[1UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ // sql
+ //
+ if (t[2UL])
+ {
+ i.sql_value.capacity (i.sql_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >::
+ bind (sqlite::bind* b,
+ image_type& i)
+ {
+ using namespace sqlite;
+
+ sqlite::statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ std::size_t n (0);
+
+ // type
+ //
+ b[n].type = sqlite::image_traits<
+ ::std::string,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.type_value.data ();
+ b[n].size = &i.type_size;
+ b[n].capacity = i.type_value.capacity ();
+ b[n].is_null = &i.type_null;
+ n++;
+
+ // name
+ //
+ b[n].type = sqlite::image_traits<
+ ::std::string,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.name_value.data ();
+ b[n].size = &i.name_size;
+ b[n].capacity = i.name_value.capacity ();
+ b[n].is_null = &i.name_null;
+ n++;
+
+ // sql
+ //
+ b[n].type = sqlite::image_traits<
+ ::std::string,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.sql_value.data ();
+ b[n].size = &i.sql_size;
+ b[n].capacity = i.sql_value.capacity ();
+ b[n].is_null = &i.sql_null;
+ n++;
+ }
+
+ void access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >::
+ init (view_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // type
+ //
+ {
+ ::std::string& v =
+ o.type;
+
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::set_value (
+ v,
+ i.type_value,
+ i.type_size,
+ i.type_null);
+ }
+
+ // name
+ //
+ {
+ ::std::string& v =
+ o.name;
+
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+
+ // sql
+ //
+ {
+ ::std::string& v =
+ o.sql;
+
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::set_value (
+ v,
+ i.sql_value,
+ i.sql_size,
+ i.sql_null);
+ }
+ }
+
+ access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >::query_base_type
+ access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >::
+ query_statement (const query_base_type& q)
+ {
+ query_base_type r (
+ "SELECT "
+ "\"type\", "
+ "\"type\", "
+ "\"sql\" ");
+
+ r += "FROM \"sqlite_master\"";
+
+ if (!q.empty ())
+ {
+ r += " ";
+ r += q.clause_prefix ();
+ r += q;
+ }
+
+ return r;
+ }
+
+ result< access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >::view_type >
+ access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >::
+ query (database& db, const query_base_type& q)
+ {
+ using namespace sqlite;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ const query_base_type& qs (query_statement (q));
+ qs.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ conn,
+ qs.clause (),
+ false,
+ true,
+ qs.parameters_binding (),
+ imb));
+
+ st->execute ();
+
+ shared_ptr< odb::view_result_impl<view_type> > r (
+ new (shared) sqlite::view_result_impl<view_type> (
+ qs, st, sts, 0));
+
+ return result<view_type> (r);
+ }
+}
+
+#include <odb/post.hxx>
diff --git a/bdep/database-views-odb.hxx b/bdep/database-views-odb.hxx
new file mode 100644
index 0000000..c9ca7fb
--- /dev/null
+++ b/bdep/database-views-odb.hxx
@@ -0,0 +1,148 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#ifndef BDEP_DATABASE_VIEWS_ODB_HXX
+#define BDEP_DATABASE_VIEWS_ODB_HXX
+
+// Begin prologue.
+//
+#include <bdep/wrapper-traits.hxx>
+//
+// End prologue.
+
+#include <odb/version.hxx>
+
+#if ODB_VERSION != 20478UL
+#error ODB runtime version mismatch
+#endif
+
+#include <odb/pre.hxx>
+
+#include <bdep/database-views.hxx>
+
+#include <memory>
+#include <cstddef>
+#include <utility>
+
+#include <odb/core.hxx>
+#include <odb/traits.hxx>
+#include <odb/callback.hxx>
+#include <odb/wrapper-traits.hxx>
+#include <odb/pointer-traits.hxx>
+#include <odb/container-traits.hxx>
+#include <odb/no-op-cache-traits.hxx>
+#include <odb/result.hxx>
+#include <odb/view-image.hxx>
+#include <odb/view-result.hxx>
+
+#include <odb/details/unused.hxx>
+#include <odb/details/shared-ptr.hxx>
+
+namespace odb
+{
+ // sqlite_master
+ //
+ template <>
+ struct class_traits< ::bdep::sqlite_master >
+ {
+ static const class_kind kind = class_view;
+ };
+
+ template <>
+ class access::view_traits< ::bdep::sqlite_master >
+ {
+ public:
+ typedef ::bdep::sqlite_master view_type;
+ typedef ::bdep::sqlite_master* pointer_type;
+
+ static void
+ callback (database&, view_type&, callback_event);
+ };
+}
+
+#include <odb/details/buffer.hxx>
+
+#include <odb/sqlite/version.hxx>
+#include <odb/sqlite/forward.hxx>
+#include <odb/sqlite/binding.hxx>
+#include <odb/sqlite/sqlite-types.hxx>
+#include <odb/sqlite/query.hxx>
+
+namespace odb
+{
+ // sqlite_master
+ //
+ template <>
+ class access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >:
+ public access::view_traits< ::bdep::sqlite_master >
+ {
+ public:
+ struct image_type
+ {
+ // type
+ //
+ details::buffer type_value;
+ std::size_t type_size;
+ bool type_null;
+
+ // name
+ //
+ details::buffer name_value;
+ std::size_t name_size;
+ bool name_null;
+
+ // sql
+ //
+ details::buffer sql_value;
+ std::size_t sql_size;
+ bool sql_null;
+
+ std::size_t version;
+ };
+
+ typedef sqlite::view_statements<view_type> statements_type;
+
+ typedef sqlite::query_base query_base_type;
+ struct query_columns
+ {
+ };
+
+ static const bool versioned = false;
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (sqlite::bind*,
+ image_type&);
+
+ static void
+ init (view_type&,
+ const image_type&,
+ database*);
+
+ static const std::size_t column_count = 3UL;
+
+ static query_base_type
+ query_statement (const query_base_type&);
+
+ static result<view_type>
+ query (database&, const query_base_type&);
+ };
+
+ template <>
+ class access::view_traits_impl< ::bdep::sqlite_master, id_common >:
+ public access::view_traits_impl< ::bdep::sqlite_master, id_sqlite >
+ {
+ };
+}
+
+#include <bdep/database-views-odb.ixx>
+
+#include <odb/post.hxx>
+
+#endif // BDEP_DATABASE_VIEWS_ODB_HXX
diff --git a/bdep/database-views-odb.ixx b/bdep/database-views-odb.ixx
new file mode 100644
index 0000000..96c8c45
--- /dev/null
+++ b/bdep/database-views-odb.ixx
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+namespace odb
+{
+ // sqlite_master
+ //
+
+ inline
+ void access::view_traits< ::bdep::sqlite_master >::
+ callback (database& db, view_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+}
+
+namespace odb
+{
+ // sqlite_master
+ //
+}
+
diff --git a/bdep/default-options-files.cxx b/bdep/default-options-files.cxx
new file mode 100644
index 0000000..b18acd9
--- /dev/null
+++ b/bdep/default-options-files.cxx
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/default-options-files.hxx>
+
+#include <map>
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_default_options_files_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep\033[0m \033[4mcommand\033[0m [\033[4mmode-options\033[0m] ...\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "Instead of having a separate config file format for tool configuration, the" << ::std::endl
+ << "\033[1mbuild2\033[0m toolchain uses \033[4mdefault options files\033[0m which contain the same options as" << ::std::endl
+ << "what can be specified on the command line. The default options files are like" << ::std::endl
+ << "options files that one can specify with \033[1m--options-file\033[0m (\033[1mbdep-common-options(1)\033[0m)" << ::std::endl
+ << "except that they are loaded by default." << ::std::endl
+ << ::std::endl
+ << "The default options files are searched for in the \033[1m.build2/\033[0m and \033[1m.build2/local/\033[0m" << ::std::endl
+ << "subdirectories of each outer directory beginning from the \033[4mstart directory\033[0m and" << ::std::endl
+ << "until reaching either the home directory or the filesystem root directory (both" << ::std::endl
+ << "excluding). Then in the \033[1m.build2/\033[0m subdirectory of the home directory and finally" << ::std::endl
+ << "in the system directory (for example, \033[1m/etc/build2/\033[0m) if configured." << ::std::endl
+ << ::std::endl
+ << "Once the search is complete, the files are loaded in the reverse order, that" << ::std::endl
+ << "is, beginning from the system directory (if any), followed by the home" << ::std::endl
+ << "directory, ending with the start directory, and finishing off with the options" << ::std::endl
+ << "specified on the command line. In other words, the files are loaded from the" << ::std::endl
+ << "more generic to the more specific with the command line options having the" << ::std::endl
+ << "ability to override any values specified in the default options files." << ::std::endl
+ << ::std::endl
+ << "The start directory, the names of the default options files, and in which order" << ::std::endl
+ << "they are loaded within each directory are determined by the \033[4mcommand\033[0m and" << ::std::endl
+ << "potentially its \033[4mmode-options\033[0m. See each command's DEFAULT OPTIONS FILES section" << ::std::endl
+ << "for details." << ::std::endl
+ << ::std::endl
+ << "If a default options file contains \033[1m--no-default-options\033[0m, then the search is" << ::std::endl
+ << "stopped at the directory containing this file and no outer files are loaded. If" << ::std::endl
+ << "this option is specified on the command line, then none of the default options" << ::std::endl
+ << "files are searched for or loaded." << ::std::endl
+ << ::std::endl
+ << "An additional directory containing default options files can be specified with" << ::std::endl
+ << "\033[1m--default-options\033[0m. If such a directory is a subdirectory of the start directory" << ::std::endl
+ << "or is between the start directory and the end of the outer search, then its" << ::std::endl
+ << "configuration files are loaded at the corresponding point in the directory" << ::std::endl
+ << "hierarchy. Otherwise, they are loaded after the home directory." << ::std::endl
+ << ::std::endl
+ << "The presence of the \033[1m.git\033[0m filesystem entry causes the default options files in" << ::std::endl
+ << "this directory and any of its subdirectories to be considered remote. Depending" << ::std::endl
+ << "on the command, some security-sensitive options may be disallowed or trigger a" << ::std::endl
+ << "prompt when specified in remote options files (in the current implementation" << ::std::endl
+ << "this is the case even for files from the \033[1m.build2/local/\033[0m subdirectory since the" << ::std::endl
+ << "mere location is not a sufficient ground to definitively conclude that the file" << ::std::endl
+ << "is not remote; to be sure we would need to query the version control system)." << ::std::endl
+ << "Note that additional default options files specified with \033[1m--default-options\033[0m are" << ::std::endl
+ << "never considered remote." << ::std::endl
+ << ::std::endl
+ << "The order in which default options files are loaded is traced at the verbosity" << ::std::endl
+ << "level 3 (\033[1m-V\033[0m option) or higher." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/default-options-files.hxx b/bdep/default-options-files.hxx
new file mode 100644
index 0000000..bbf6663
--- /dev/null
+++ b/bdep/default-options-files.hxx
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_DEFAULT_OPTIONS_FILES_HXX
+#define BDEP_DEFAULT_OPTIONS_FILES_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/common-options.hxx>
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_default_options_files_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_DEFAULT_OPTIONS_FILES_HXX
diff --git a/bdep/deinit-options.cxx b/bdep/deinit-options.cxx
new file mode 100644
index 0000000..ecdac67
--- /dev/null
+++ b/bdep/deinit-options.cxx
@@ -0,0 +1,749 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/deinit-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_deinit_options
+ //
+
+ cmd_deinit_options::
+ cmd_deinit_options ()
+ : force_ (),
+ no_fetch_ ()
+ {
+ }
+
+ bool cmd_deinit_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_deinit_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_deinit_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_deinit_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_deinit_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_deinit_options::
+ merge (const cmd_deinit_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.force_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->force_, a.force_);
+ }
+
+ if (a.no_fetch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_fetch_, a.no_fetch_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_deinit_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEINIT OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--force\033[0m Deinitialize packages without attempting to remove" << ::std::endl
+ << " them from the build configuration. This mode is" << ::std::endl
+ << " primarily useful when the configuration directory has" << ::std::endl
+ << " been removed or is otherwise unusable." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-fetch\033[0m Do not re-fetch the repository information before" << ::std::endl
+ << " attempting to replace packages being deinitialized" << ::std::endl
+ << " with versions from repositories." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_deinit_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_deinit_options_desc_type ()
+ {
+ ::bdep::cmd_deinit_options::fill (*this);
+ }
+ };
+
+ void cmd_deinit_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --force
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--force", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-fetch
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-fetch", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_deinit_options::
+ description ()
+ {
+ static _cli_cmd_deinit_options_desc_type _cli_cmd_deinit_options_desc_;
+ return _cli_cmd_deinit_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_deinit_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_deinit_options_map;
+
+ static _cli_cmd_deinit_options_map _cli_cmd_deinit_options_map_;
+
+ struct _cli_cmd_deinit_options_map_init
+ {
+ _cli_cmd_deinit_options_map_init ()
+ {
+ _cli_cmd_deinit_options_map_["--force"] =
+ &::bdep::cli::thunk< cmd_deinit_options, &cmd_deinit_options::force_ >;
+ _cli_cmd_deinit_options_map_["--no-fetch"] =
+ &::bdep::cli::thunk< cmd_deinit_options, &cmd_deinit_options::no_fetch_ >;
+ }
+ };
+
+ static _cli_cmd_deinit_options_map_init _cli_cmd_deinit_options_map_init_;
+
+ bool cmd_deinit_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_deinit_options_map::const_iterator i (_cli_cmd_deinit_options_map_.find (o));
+
+ if (i != _cli_cmd_deinit_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_deinit_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_deinit_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep deinit\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mdeinit\033[0m command deinitializes the specified project packages (\033[4mpkg-spec\033[0m), or," << ::std::endl
+ << "if the project itself is specified (\033[4mprj-spec\033[0m), all its previously initialized" << ::std::endl
+ << "packages, in one or more build configurations (\033[4mcfg-spec\033[0m)." << ::std::endl
+ << ::std::endl
+ << "If no project directory is specified, then the current working directory is" << ::std::endl
+ << "assumed. If no configuration is specified, then the default configurations are" << ::std::endl
+ << "assumed. See \033[1mbdep-projects-configs(1)\033[0m for details on specifying projects and" << ::std::endl
+ << "configurations." << ::std::endl;
+
+ p = ::bdep::cmd_deinit_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mdeinit\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-deinit.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mdeinit\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/deinit-options.hxx b/bdep/deinit-options.hxx
new file mode 100644
index 0000000..6dc8a3d
--- /dev/null
+++ b/bdep/deinit-options.hxx
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_DEINIT_OPTIONS_HXX
+#define BDEP_DEINIT_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_deinit_options: public ::bdep::project_options
+ {
+ public:
+ cmd_deinit_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_deinit_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ force () const;
+
+ bool&
+ force ();
+
+ void
+ force (const bool&);
+
+ const bool&
+ no_fetch () const;
+
+ bool&
+ no_fetch ();
+
+ void
+ no_fetch (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_deinit_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool force_;
+ bool no_fetch_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_deinit_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/deinit-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_DEINIT_OPTIONS_HXX
diff --git a/bdep/deinit-options.ixx b/bdep/deinit-options.ixx
new file mode 100644
index 0000000..d8d5ba6
--- /dev/null
+++ b/bdep/deinit-options.ixx
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_deinit_options
+ //
+
+ inline const bool& cmd_deinit_options::
+ force () const
+ {
+ return this->force_;
+ }
+
+ inline bool& cmd_deinit_options::
+ force ()
+ {
+ return this->force_;
+ }
+
+ inline void cmd_deinit_options::
+ force (const bool& x)
+ {
+ this->force_ = x;
+ }
+
+ inline const bool& cmd_deinit_options::
+ no_fetch () const
+ {
+ return this->no_fetch_;
+ }
+
+ inline bool& cmd_deinit_options::
+ no_fetch ()
+ {
+ return this->no_fetch_;
+ }
+
+ inline void cmd_deinit_options::
+ no_fetch (const bool& x)
+ {
+ this->no_fetch_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/fetch-options.cxx b/bdep/fetch-options.cxx
new file mode 100644
index 0000000..f1b5260
--- /dev/null
+++ b/bdep/fetch-options.cxx
@@ -0,0 +1,730 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/fetch-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_fetch_options
+ //
+
+ cmd_fetch_options::
+ cmd_fetch_options ()
+ : full_ ()
+ {
+ }
+
+ bool cmd_fetch_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_fetch_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_fetch_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_fetch_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_fetch_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_fetch_options::
+ merge (const cmd_fetch_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.full_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->full_, a.full_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_fetch_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mFETCH OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--full\033[0m|\033[1m-F\033[0m Perform a full re-fetch of all the repositories." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_fetch_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_fetch_options_desc_type ()
+ {
+ ::bdep::cmd_fetch_options::fill (*this);
+ }
+ };
+
+ void cmd_fetch_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --full
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-F");
+ std::string dv;
+ ::bdep::cli::option o ("--full", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_fetch_options::
+ description ()
+ {
+ static _cli_cmd_fetch_options_desc_type _cli_cmd_fetch_options_desc_;
+ return _cli_cmd_fetch_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_fetch_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_fetch_options_map;
+
+ static _cli_cmd_fetch_options_map _cli_cmd_fetch_options_map_;
+
+ struct _cli_cmd_fetch_options_map_init
+ {
+ _cli_cmd_fetch_options_map_init ()
+ {
+ _cli_cmd_fetch_options_map_["--full"] =
+ &::bdep::cli::thunk< cmd_fetch_options, &cmd_fetch_options::full_ >;
+ _cli_cmd_fetch_options_map_["-F"] =
+ &::bdep::cli::thunk< cmd_fetch_options, &cmd_fetch_options::full_ >;
+ }
+ };
+
+ static _cli_cmd_fetch_options_map_init _cli_cmd_fetch_options_map_init_;
+
+ bool cmd_fetch_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_fetch_options_map::const_iterator i (_cli_cmd_fetch_options_map_.find (o));
+
+ if (i != _cli_cmd_fetch_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_fetch_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_fetch_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep fetch\033[0m [\033[4moptions\033[0m] [\033[1m--full\033[0m|\033[1m-F\033[0m] [\033[4mprj-spec\033[0m] [\033[4mcfg-spec\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mfetch\033[0m command fetches the list of packages available in the project's" << ::std::endl
+ << "prerequisite/complement repositories in one or more build configurations." << ::std::endl
+ << ::std::endl
+ << "If no project or package directory is specified, then the current working" << ::std::endl
+ << "directory is assumed. If no configuration is specified, then the default" << ::std::endl
+ << "configurations are assumed. See \033[1mbdep-projects-configs(1)\033[0m for details on" << ::std::endl
+ << "specifying projects and configurations." << ::std::endl
+ << ::std::endl
+ << "If the \033[1m--full|-F\033[0m option is specified, then instead \033[1mfetch\033[0m performs a full" << ::std::endl
+ << "re-fetch of all the repositories added to the configuration. This mode is" << ::std::endl
+ << "primarily useful when a configuration (and some of the prerequisite/complement" << ::std::endl
+ << "repositories) are shared between several projects. In this situation an" << ::std::endl
+ << "incremental fetch may result in an inconsistent repository state." << ::std::endl;
+
+ p = ::bdep::cmd_fetch_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mfetch\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-fetch.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mfetch\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/fetch-options.hxx b/bdep/fetch-options.hxx
new file mode 100644
index 0000000..71326ab
--- /dev/null
+++ b/bdep/fetch-options.hxx
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_FETCH_OPTIONS_HXX
+#define BDEP_FETCH_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_fetch_options: public ::bdep::project_options
+ {
+ public:
+ cmd_fetch_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_fetch_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ full () const;
+
+ bool&
+ full ();
+
+ void
+ full (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_fetch_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool full_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_fetch_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/fetch-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_FETCH_OPTIONS_HXX
diff --git a/bdep/fetch-options.ixx b/bdep/fetch-options.ixx
new file mode 100644
index 0000000..ec21edc
--- /dev/null
+++ b/bdep/fetch-options.ixx
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_fetch_options
+ //
+
+ inline const bool& cmd_fetch_options::
+ full () const
+ {
+ return this->full_;
+ }
+
+ inline bool& cmd_fetch_options::
+ full ()
+ {
+ return this->full_;
+ }
+
+ inline void cmd_fetch_options::
+ full (const bool& x)
+ {
+ this->full_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/help-options.cxx b/bdep/help-options.cxx
new file mode 100644
index 0000000..7ae2db9
--- /dev/null
+++ b/bdep/help-options.cxx
@@ -0,0 +1,680 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/help-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // help_options
+ //
+
+ help_options::
+ help_options ()
+ {
+ }
+
+ bool help_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool help_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool help_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool help_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool help_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void help_options::
+ merge (const help_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // common_options base
+ //
+ ::bdep::common_options::merge (a);
+ }
+
+ ::bdep::cli::usage_para help_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ // common_options base
+ //
+ p = ::bdep::common_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_help_options_desc_type: ::bdep::cli::options
+ {
+ _cli_help_options_desc_type ()
+ {
+ ::bdep::help_options::fill (*this);
+ }
+ };
+
+ void help_options::
+ fill (::bdep::cli::options& os)
+ {
+ // common_options base
+ //
+ ::bdep::common_options::fill (os);
+ }
+
+ const ::bdep::cli::options& help_options::
+ description ()
+ {
+ static _cli_help_options_desc_type _cli_help_options_desc_;
+ return _cli_help_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (help_options&, ::bdep::cli::scanner&)>
+ _cli_help_options_map;
+
+ static _cli_help_options_map _cli_help_options_map_;
+
+ struct _cli_help_options_map_init
+ {
+ _cli_help_options_map_init ()
+ {
+ }
+ };
+
+ static _cli_help_options_map_init _cli_help_options_map_init_;
+
+ bool help_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_help_options_map::const_iterator i (_cli_help_options_map_.find (o));
+
+ if (i != _cli_help_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // common_options base
+ //
+ if (::bdep::common_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool help_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_help_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep help\033[0m [\033[4mcommand\033[0m | \033[4mtopic\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "Show the detailed help for \033[4mcommand\033[0m or help \033[4mtopic\033[0m or a summary of available" << ::std::endl
+ << "commands and topics if none was specified." << ::std::endl;
+
+ p = ::bdep::help_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mhelp\033[0m command the following options files are searched for only in the" << ::std::endl
+ << "predefined directories (home, system, etc) and, if found, loaded in the order" << ::std::endl
+ << "listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-help.options" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/help-options.hxx b/bdep/help-options.hxx
new file mode 100644
index 0000000..004be9a
--- /dev/null
+++ b/bdep/help-options.hxx
@@ -0,0 +1,119 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_HELP_OPTIONS_HXX
+#define BDEP_HELP_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/common-options.hxx>
+
+namespace bdep
+{
+ class help_options: public ::bdep::common_options
+ {
+ public:
+ help_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const help_options&);
+
+ // Option accessors and modifiers.
+ //
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_help_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_help_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/help-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_HELP_OPTIONS_HXX
diff --git a/bdep/help-options.ixx b/bdep/help-options.ixx
new file mode 100644
index 0000000..669905a
--- /dev/null
+++ b/bdep/help-options.ixx
@@ -0,0 +1,21 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // help_options
+ //
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/init-options.cxx b/bdep/init-options.cxx
new file mode 100644
index 0000000..998e31b
--- /dev/null
+++ b/bdep/init-options.cxx
@@ -0,0 +1,1109 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/init-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_init_options
+ //
+
+ cmd_init_options::
+ cmd_init_options ()
+ : empty_ (),
+ config_add_ (),
+ config_add_specified_ (false),
+ config_create_ (),
+ config_create_specified_ (false),
+ no_sync_ (),
+ sys_no_query_ (),
+ sys_install_ (),
+ sys_no_fetch_ (),
+ sys_no_stub_ (),
+ sys_yes_ (),
+ sys_sudo_ ("sudo"),
+ sys_sudo_specified_ (false),
+ create_host_config_ (),
+ create_build2_config_ ()
+ {
+ }
+
+ bool cmd_init_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_init_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_init_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_init_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_init_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_init_options::
+ merge (const cmd_init_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // configuration_add_options base
+ //
+ ::bdep::configuration_add_options::merge (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.empty_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->empty_, a.empty_);
+ }
+
+ if (a.config_add_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->config_add_, a.config_add_);
+ this->config_add_specified_ = true;
+ }
+
+ if (a.config_create_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->config_create_, a.config_create_);
+ this->config_create_specified_ = true;
+ }
+
+ if (a.no_sync_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_sync_, a.no_sync_);
+ }
+
+ if (a.sys_no_query_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_no_query_, a.sys_no_query_);
+ }
+
+ if (a.sys_install_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_install_, a.sys_install_);
+ }
+
+ if (a.sys_no_fetch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_no_fetch_, a.sys_no_fetch_);
+ }
+
+ if (a.sys_no_stub_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_no_stub_, a.sys_no_stub_);
+ }
+
+ if (a.sys_yes_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_yes_, a.sys_yes_);
+ }
+
+ if (a.sys_sudo_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->sys_sudo_, a.sys_sudo_);
+ this->sys_sudo_specified_ = true;
+ }
+
+ if (a.create_host_config_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->create_host_config_, a.create_host_config_);
+ }
+
+ if (a.create_build2_config_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->create_build2_config_, a.create_build2_config_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_init_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mINIT OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--empty\033[0m|\033[1m-E\033[0m Initialize an empty build configuration set." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--config-add\033[0m|\033[1m-A\033[0m \033[4mdir\033[0m Add an existing build configuration \033[4mdir\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--config-create\033[0m|\033[1m-C\033[0m \033[4mdir\033[0m Create a new build configuration in \033[4mdir\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-sync\033[0m Enter the project into the database but do not" << ::std::endl
+ << " initialize it in the build configurations. The" << ::std::endl
+ << " initialization can be finished later with an explicit" << ::std::endl
+ << " \033[1mbdep-sync(1)\033[0m command." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-no-query\033[0m Do not query the system package manager for the" << ::std::endl
+ << " installed versions of packages specified with the" << ::std::endl
+ << " \033[1msys\033[0m scheme. See the corresponding \033[1mbpkg-pkg-build(1)\033[0m" << ::std::endl
+ << " option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-install\033[0m Instruct the system package manager to install" << ::std::endl
+ << " available versions of packages specified with the" << ::std::endl
+ << " \033[1msys\033[0m scheme that are not already installed. See the" << ::std::endl
+ << " corresponding \033[1mbpkg-pkg-build(1)\033[0m option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-no-fetch\033[0m Do not fetch the system package manager metadata" << ::std::endl
+ << " before querying for available versions of packages" << ::std::endl
+ << " specified with the \033[1msys\033[0m scheme. See the corresponding" << ::std::endl
+ << " \033[1mbpkg-pkg-build(1)\033[0m option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-no-stub\033[0m Do no require a stub for packages specified with the" << ::std::endl
+ << " \033[1msys\033[0m scheme. See the corresponding \033[1mbpkg-pkg-build(1)\033[0m" << ::std::endl
+ << " option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-yes\033[0m Assume the answer to the system package manager" << ::std::endl
+ << " prompts is \033[1myes\033[0m. See the corresponding" << ::std::endl
+ << " \033[1mbpkg-pkg-build(1)\033[0m option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-sudo\033[0m \033[4mprog\033[0m The \033[1msudo\033[0m program to use for system package manager" << ::std::endl
+ << " interactions that normally require administrative" << ::std::endl
+ << " privileges (fetch package metadata, install packages," << ::std::endl
+ << " etc). See the corresponding \033[1mbpkg-pkg-build(1)\033[0m option" << ::std::endl
+ << " for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--create-host-config\033[0m Create a configuration for build-time dependencies" << ::std::endl
+ << " without prompt (see \033[1mbdep-sync(1)\033[0m for details)." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--create-build2-config\033[0m Create a configuration for build system module" << ::std::endl
+ << " dependencies without prompt (see \033[1mbdep-sync(1)\033[0m for" << ::std::endl
+ << " details)." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // configuration_add_options base
+ //
+ p = ::bdep::configuration_add_options::print_usage (os, p);
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_init_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_init_options_desc_type ()
+ {
+ ::bdep::cmd_init_options::fill (*this);
+ }
+ };
+
+ void cmd_init_options::
+ fill (::bdep::cli::options& os)
+ {
+ // configuration_add_options base
+ //
+ ::bdep::configuration_add_options::fill (os);
+
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --empty
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-E");
+ std::string dv;
+ ::bdep::cli::option o ("--empty", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --config-add
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-A");
+ std::string dv;
+ ::bdep::cli::option o ("--config-add", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --config-create
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-C");
+ std::string dv;
+ ::bdep::cli::option o ("--config-create", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --no-sync
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-sync", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-no-query
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-no-query", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-install
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-install", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-no-fetch
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-no-fetch", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-no-stub
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-no-stub", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-yes
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-yes", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-sudo
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("sudo");
+ ::bdep::cli::option o ("--sys-sudo", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --create-host-config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--create-host-config", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --create-build2-config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--create-build2-config", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_init_options::
+ description ()
+ {
+ static _cli_cmd_init_options_desc_type _cli_cmd_init_options_desc_;
+ return _cli_cmd_init_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_init_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_init_options_map;
+
+ static _cli_cmd_init_options_map _cli_cmd_init_options_map_;
+
+ struct _cli_cmd_init_options_map_init
+ {
+ _cli_cmd_init_options_map_init ()
+ {
+ _cli_cmd_init_options_map_["--empty"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::empty_ >;
+ _cli_cmd_init_options_map_["-E"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::empty_ >;
+ _cli_cmd_init_options_map_["--config-add"] =
+ &::bdep::cli::thunk< cmd_init_options, dir_path, &cmd_init_options::config_add_,
+ &cmd_init_options::config_add_specified_ >;
+ _cli_cmd_init_options_map_["-A"] =
+ &::bdep::cli::thunk< cmd_init_options, dir_path, &cmd_init_options::config_add_,
+ &cmd_init_options::config_add_specified_ >;
+ _cli_cmd_init_options_map_["--config-create"] =
+ &::bdep::cli::thunk< cmd_init_options, dir_path, &cmd_init_options::config_create_,
+ &cmd_init_options::config_create_specified_ >;
+ _cli_cmd_init_options_map_["-C"] =
+ &::bdep::cli::thunk< cmd_init_options, dir_path, &cmd_init_options::config_create_,
+ &cmd_init_options::config_create_specified_ >;
+ _cli_cmd_init_options_map_["--no-sync"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::no_sync_ >;
+ _cli_cmd_init_options_map_["--sys-no-query"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::sys_no_query_ >;
+ _cli_cmd_init_options_map_["--sys-install"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::sys_install_ >;
+ _cli_cmd_init_options_map_["--sys-no-fetch"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::sys_no_fetch_ >;
+ _cli_cmd_init_options_map_["--sys-no-stub"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::sys_no_stub_ >;
+ _cli_cmd_init_options_map_["--sys-yes"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::sys_yes_ >;
+ _cli_cmd_init_options_map_["--sys-sudo"] =
+ &::bdep::cli::thunk< cmd_init_options, string, &cmd_init_options::sys_sudo_,
+ &cmd_init_options::sys_sudo_specified_ >;
+ _cli_cmd_init_options_map_["--create-host-config"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::create_host_config_ >;
+ _cli_cmd_init_options_map_["--create-build2-config"] =
+ &::bdep::cli::thunk< cmd_init_options, &cmd_init_options::create_build2_config_ >;
+ }
+ };
+
+ static _cli_cmd_init_options_map_init _cli_cmd_init_options_map_init_;
+
+ bool cmd_init_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_init_options_map::const_iterator i (_cli_cmd_init_options_map_.find (o));
+
+ if (i != _cli_cmd_init_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // configuration_add_options base
+ //
+ if (::bdep::configuration_add_options::_parse (o, s))
+ return true;
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_init_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_init_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep init\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mpkg-args\033[0m]" << ::std::endl
+ << "\033[1mbdep init\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m] \033[1m--empty|-E\033[0m" << ::std::endl
+ << "\033[1mbdep init\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] \033[1m--config-add|-A\033[0m \033[4mcfg-dir\033[0m [\033[1m@\033[0m\033[4mcfg-name\033[0m]" << ::std::endl
+ << " [\033[4mpkg-args\033[0m]" << ::std::endl
+ << "\033[1mbdep init\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] \033[1m--config-create|-C\033[0m \033[4mcfg-dir\033[0m [\033[1m@\033[0m\033[4mcfg-name\033[0m]" << ::std::endl
+ << " [\033[4mcfg-args\033[0m] [\033[1m--\033[0m \033[4mpkg-args\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m)... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m" << ::std::endl
+ << "\033[4mpkg-args\033[0m = (\033[1m?\033[0m\033[4mpkg\033[0m | \033[4mcfg-var\033[0m)..." << ::std::endl
+ << "\033[4mcfg-args\033[0m = [\033[1m--\033[0m [\033[4mbpkg-options\033[0m]] [\033[1m--existing\033[0m|\033[1m-e\033[0m | (\033[4mmodule\033[0m | \033[4mcfg-var\033[0m)...]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1minit\033[0m command initializes a project in one or more build configurations. The" << ::std::endl
+ << "first form initializes the specified project packages (\033[4mpkg-spec\033[0m), or, if the" << ::std::endl
+ << "project itself is specified (\033[4mprj-spec\033[0m), all its available packages, in one or" << ::std::endl
+ << "more build configurations (\033[4mcfg-spec\033[0m) that have already been associated with the" << ::std::endl
+ << "project (\033[1mbdep-config(1)\033[0m)." << ::std::endl
+ << ::std::endl
+ << "If no project directory is specified, then the current working directory is" << ::std::endl
+ << "assumed. If no configuration is specified, then the default configuration is" << ::std::endl
+ << "assumed (failing if multiple default configurations are present). Note that" << ::std::endl
+ << "unlike in all other commands, in \033[1minit\033[0m the package to initialize in \033[4mpkg-spec\033[0m" << ::std::endl
+ << "cannot be specified as a \033[4mpkg\033[0m name, only as a directory with \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m. See" << ::std::endl
+ << "\033[1mbdep-projects-configs(1)\033[0m for details on specifying projects and configurations." << ::std::endl
+ << "Optional \033[4mpkg-args\033[0m are the additional dependency packages and/or configuration" << ::std::endl
+ << "variables to pass to the underlying \033[1mbpkg-pkg-build(1)\033[0m command." << ::std::endl
+ << ::std::endl
+ << "The second form (\033[1m--empty\033[0m is specified) initializes an empty project database" << ::std::endl
+ << "that can later be used to first add build configurations (\033[1mbdep-config(1)\033[0m) and" << ::std::endl
+ << "then initialize project packages using the first form." << ::std::endl
+ << ::std::endl
+ << "The third (\033[1m--config-add\033[0m) and fourth (\033[1m--config-create\033[0m) forms are shortcuts to" << ::std::endl
+ << "first adding an existing or newly created build configuration and then" << ::std::endl
+ << "initializing project packages in that configuration. Semantically they are" << ::std::endl
+ << "equivalent to first performing the \033[1mconfig add\033[0m or \033[1mconfig create\033[0m commands" << ::std::endl
+ << "(\033[1mbdep-config(1)\033[0m), respectively, followed by the first form. Optional \033[4mcfg-args\033[0m" << ::std::endl
+ << "in the fourth form are the additional arguments to the underlying" << ::std::endl
+ << "\033[1mbpkg-cfg-create(1)\033[0m command. Note that in this case to specify \033[4mpkg-args\033[0m without" << ::std::endl
+ << "specifying \033[4mcfg-args\033[0m you have to use two \033[1m--\033[0m separators, for example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep init -C ../prj-gcc @gcc -- -- ?sys:libsqlite3/*" << ::std::endl
+ << ::std::endl
+ << "Configuration variables can be specified to only apply to specific packages in" << ::std::endl
+ << "\033[4mpkg-args\033[0m using the argument grouping mechanism (\033[1mbdep-argument-grouping(1)\033[0m)." << ::std::endl
+ << "Additionally, such packages can be placed into specific linked configurations" << ::std::endl
+ << "by specifying the configuration with one of the \033[1m--config*\033[0m options (or \033[1m@\033[0m" << ::std::endl
+ << "notation) using the same grouping mechanism. For example (assuming \033[1mgcc\033[0m is" << ::std::endl
+ << "linked to \033[1mcommon\033[0m):" << ::std::endl
+ << ::std::endl
+ << "$ bdep init @gcc { @common config.liblarge.extra=true }+ ?liblarge" << ::std::endl
+ << ::std::endl
+ << "\033[1mEXAMPLES\033[0m" << ::std::endl
+ << ::std::endl
+ << "As an example, consider project \033[1mprj\033[0m with two packages, \033[1mfoo\033[0m and \033[1mlibfoo\033[0m:" << ::std::endl
+ << ::std::endl
+ << "prj/" << ::std::endl
+ << "|-- foo/" << ::std::endl
+ << "`-- libfoo/" << ::std::endl
+ << ::std::endl
+ << "The following invocations illustrate the common \033[1minit\033[0m use cases (the current" << ::std::endl
+ << "working directory is shown before the shell prompt)." << ::std::endl
+ << ::std::endl
+ << "Create new build configuration in \033[1m../prj-gcc\033[0m, call it \033[1mgcc\033[0m, and initialize" << ::std::endl
+ << "project packages \033[1mfoo\033[0m and \033[1mlibfoo\033[0m in this configuration:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep init -C ../prj-gcc @gcc cc config.cxx=g++" << ::std::endl
+ << ::std::endl
+ << "Create new build configuration in \033[1m../prj-clang\033[0m using \033[1mbpkg-cfg-create(1)\033[0m. Then" << ::std::endl
+ << "add it calling it \033[1mclang\033[0m and initialize project package \033[1mfoo\033[0m in this" << ::std::endl
+ << "configuration:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bpkg create -d ../prj-clang cc config.cxx=clang++" << ::std::endl
+ << "prj/$ cd foo" << ::std::endl
+ << "foo/$ bdep init -A ../../prj-clang @clang" << ::std::endl
+ << ::std::endl
+ << "Initialize project package \033[1mlibfoo\033[0m in the build configuration \033[1mclang\033[0m:" << ::std::endl
+ << ::std::endl
+ << "foo/$ cd .." << ::std::endl
+ << "prj/$ bdep init -d libfoo @clang" << ::std::endl
+ << ::std::endl
+ << "The following set of invocations achieves the same end result but using the" << ::std::endl
+ << "\033[1mbdep-config(1)\033[0m command to manage configuration." << ::std::endl
+ << ::std::endl
+ << "Initialize an empty project database:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep init --empty" << ::std::endl
+ << ::std::endl
+ << "Create new build configuration in \033[1m../prj-gcc\033[0m, call it \033[1mgcc\033[0m:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep config create ../prj-gcc @gcc cc config.cxx=g++" << ::std::endl
+ << ::std::endl
+ << "Add existing build configuration in \033[1m../prj-clang\033[0m, call it \033[1mclang\033[0m." << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep config add ../prj-clang @clang" << ::std::endl
+ << ::std::endl
+ << "Initialize project packages \033[1mfoo\033[0m and \033[1mlibfoo\033[0m in build configurations \033[1mgcc\033[0m and" << ::std::endl
+ << "\033[1mclang\033[0m." << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep init @gcc @clang" << ::std::endl
+ << ::std::endl
+ << "Or, alternatively, in all the build configurations:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep init -a" << ::std::endl;
+
+ p = ::bdep::cmd_init_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1minit\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-{config config-add}.options # if --config-add|-A" << ::std::endl
+ << "bdep-{config config-add config-create}.options # if --config-create|-C" << ::std::endl
+ << "bdep-init.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1minit\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl
+ << "--config-add|-A" << ::std::endl
+ << "--config-create|-C" << ::std::endl
+ << "--wipe" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/init-options.hxx b/bdep/init-options.hxx
new file mode 100644
index 0000000..73afb6d
--- /dev/null
+++ b/bdep/init-options.hxx
@@ -0,0 +1,261 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_INIT_OPTIONS_HXX
+#define BDEP_INIT_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_init_options: public ::bdep::configuration_add_options,
+ public ::bdep::project_options
+ {
+ public:
+ cmd_init_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_init_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ empty () const;
+
+ bool&
+ empty ();
+
+ void
+ empty (const bool&);
+
+ const dir_path&
+ config_add () const;
+
+ dir_path&
+ config_add ();
+
+ void
+ config_add (const dir_path&);
+
+ bool
+ config_add_specified () const;
+
+ void
+ config_add_specified (bool);
+
+ const dir_path&
+ config_create () const;
+
+ dir_path&
+ config_create ();
+
+ void
+ config_create (const dir_path&);
+
+ bool
+ config_create_specified () const;
+
+ void
+ config_create_specified (bool);
+
+ const bool&
+ no_sync () const;
+
+ bool&
+ no_sync ();
+
+ void
+ no_sync (const bool&);
+
+ const bool&
+ sys_no_query () const;
+
+ bool&
+ sys_no_query ();
+
+ void
+ sys_no_query (const bool&);
+
+ const bool&
+ sys_install () const;
+
+ bool&
+ sys_install ();
+
+ void
+ sys_install (const bool&);
+
+ const bool&
+ sys_no_fetch () const;
+
+ bool&
+ sys_no_fetch ();
+
+ void
+ sys_no_fetch (const bool&);
+
+ const bool&
+ sys_no_stub () const;
+
+ bool&
+ sys_no_stub ();
+
+ void
+ sys_no_stub (const bool&);
+
+ const bool&
+ sys_yes () const;
+
+ bool&
+ sys_yes ();
+
+ void
+ sys_yes (const bool&);
+
+ const string&
+ sys_sudo () const;
+
+ string&
+ sys_sudo ();
+
+ void
+ sys_sudo (const string&);
+
+ bool
+ sys_sudo_specified () const;
+
+ void
+ sys_sudo_specified (bool);
+
+ const bool&
+ create_host_config () const;
+
+ bool&
+ create_host_config ();
+
+ void
+ create_host_config (const bool&);
+
+ const bool&
+ create_build2_config () const;
+
+ bool&
+ create_build2_config ();
+
+ void
+ create_build2_config (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_init_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool empty_;
+ dir_path config_add_;
+ bool config_add_specified_;
+ dir_path config_create_;
+ bool config_create_specified_;
+ bool no_sync_;
+ bool sys_no_query_;
+ bool sys_install_;
+ bool sys_no_fetch_;
+ bool sys_no_stub_;
+ bool sys_yes_;
+ string sys_sudo_;
+ bool sys_sudo_specified_;
+ bool create_host_config_;
+ bool create_build2_config_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_init_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/init-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_INIT_OPTIONS_HXX
diff --git a/bdep/init-options.ixx b/bdep/init-options.ixx
new file mode 100644
index 0000000..50526c6
--- /dev/null
+++ b/bdep/init-options.ixx
@@ -0,0 +1,273 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_init_options
+ //
+
+ inline const bool& cmd_init_options::
+ empty () const
+ {
+ return this->empty_;
+ }
+
+ inline bool& cmd_init_options::
+ empty ()
+ {
+ return this->empty_;
+ }
+
+ inline void cmd_init_options::
+ empty (const bool& x)
+ {
+ this->empty_ = x;
+ }
+
+ inline const dir_path& cmd_init_options::
+ config_add () const
+ {
+ return this->config_add_;
+ }
+
+ inline dir_path& cmd_init_options::
+ config_add ()
+ {
+ return this->config_add_;
+ }
+
+ inline void cmd_init_options::
+ config_add (const dir_path& x)
+ {
+ this->config_add_ = x;
+ }
+
+ inline bool cmd_init_options::
+ config_add_specified () const
+ {
+ return this->config_add_specified_;
+ }
+
+ inline void cmd_init_options::
+ config_add_specified (bool x)
+ {
+ this->config_add_specified_ = x;
+ }
+
+ inline const dir_path& cmd_init_options::
+ config_create () const
+ {
+ return this->config_create_;
+ }
+
+ inline dir_path& cmd_init_options::
+ config_create ()
+ {
+ return this->config_create_;
+ }
+
+ inline void cmd_init_options::
+ config_create (const dir_path& x)
+ {
+ this->config_create_ = x;
+ }
+
+ inline bool cmd_init_options::
+ config_create_specified () const
+ {
+ return this->config_create_specified_;
+ }
+
+ inline void cmd_init_options::
+ config_create_specified (bool x)
+ {
+ this->config_create_specified_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ no_sync () const
+ {
+ return this->no_sync_;
+ }
+
+ inline bool& cmd_init_options::
+ no_sync ()
+ {
+ return this->no_sync_;
+ }
+
+ inline void cmd_init_options::
+ no_sync (const bool& x)
+ {
+ this->no_sync_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ sys_no_query () const
+ {
+ return this->sys_no_query_;
+ }
+
+ inline bool& cmd_init_options::
+ sys_no_query ()
+ {
+ return this->sys_no_query_;
+ }
+
+ inline void cmd_init_options::
+ sys_no_query (const bool& x)
+ {
+ this->sys_no_query_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ sys_install () const
+ {
+ return this->sys_install_;
+ }
+
+ inline bool& cmd_init_options::
+ sys_install ()
+ {
+ return this->sys_install_;
+ }
+
+ inline void cmd_init_options::
+ sys_install (const bool& x)
+ {
+ this->sys_install_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ sys_no_fetch () const
+ {
+ return this->sys_no_fetch_;
+ }
+
+ inline bool& cmd_init_options::
+ sys_no_fetch ()
+ {
+ return this->sys_no_fetch_;
+ }
+
+ inline void cmd_init_options::
+ sys_no_fetch (const bool& x)
+ {
+ this->sys_no_fetch_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ sys_no_stub () const
+ {
+ return this->sys_no_stub_;
+ }
+
+ inline bool& cmd_init_options::
+ sys_no_stub ()
+ {
+ return this->sys_no_stub_;
+ }
+
+ inline void cmd_init_options::
+ sys_no_stub (const bool& x)
+ {
+ this->sys_no_stub_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ sys_yes () const
+ {
+ return this->sys_yes_;
+ }
+
+ inline bool& cmd_init_options::
+ sys_yes ()
+ {
+ return this->sys_yes_;
+ }
+
+ inline void cmd_init_options::
+ sys_yes (const bool& x)
+ {
+ this->sys_yes_ = x;
+ }
+
+ inline const string& cmd_init_options::
+ sys_sudo () const
+ {
+ return this->sys_sudo_;
+ }
+
+ inline string& cmd_init_options::
+ sys_sudo ()
+ {
+ return this->sys_sudo_;
+ }
+
+ inline void cmd_init_options::
+ sys_sudo (const string& x)
+ {
+ this->sys_sudo_ = x;
+ }
+
+ inline bool cmd_init_options::
+ sys_sudo_specified () const
+ {
+ return this->sys_sudo_specified_;
+ }
+
+ inline void cmd_init_options::
+ sys_sudo_specified (bool x)
+ {
+ this->sys_sudo_specified_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ create_host_config () const
+ {
+ return this->create_host_config_;
+ }
+
+ inline bool& cmd_init_options::
+ create_host_config ()
+ {
+ return this->create_host_config_;
+ }
+
+ inline void cmd_init_options::
+ create_host_config (const bool& x)
+ {
+ this->create_host_config_ = x;
+ }
+
+ inline const bool& cmd_init_options::
+ create_build2_config () const
+ {
+ return this->create_build2_config_;
+ }
+
+ inline bool& cmd_init_options::
+ create_build2_config ()
+ {
+ return this->create_build2_config_;
+ }
+
+ inline void cmd_init_options::
+ create_build2_config (const bool& x)
+ {
+ this->create_build2_config_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/new-options.cxx b/bdep/new-options.cxx
new file mode 100644
index 0000000..0e846d8
--- /dev/null
+++ b/bdep/new-options.cxx
@@ -0,0 +1,5392 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+#include <bdep/new-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/new-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_new_c_options
+ //
+
+ cmd_new_c_options::
+ cmd_new_c_options ()
+ : cpp_ (),
+ hxx_ (),
+ hxx_specified_ (false),
+ cxx_ (),
+ cxx_specified_ (false),
+ ixx_ (),
+ ixx_specified_ (false),
+ txx_ (),
+ txx_specified_ (false),
+ mxx_ (),
+ mxx_specified_ (false)
+ {
+ }
+
+ bool cmd_new_c_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_c_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_c_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_c_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_c_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_c_options::
+ merge (const cmd_new_c_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.cpp_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->cpp_, a.cpp_);
+ }
+
+ if (a.hxx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->hxx_, a.hxx_);
+ this->hxx_specified_ = true;
+ }
+
+ if (a.cxx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->cxx_, a.cxx_);
+ this->cxx_specified_ = true;
+ }
+
+ if (a.ixx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->ixx_, a.ixx_);
+ this->ixx_specified_ = true;
+ }
+
+ if (a.txx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->txx_, a.txx_);
+ this->txx_specified_ = true;
+ }
+
+ if (a.mxx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->mxx_, a.mxx_);
+ this->mxx_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_c_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_c_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_c_options_desc_type ()
+ {
+ ::bdep::cmd_new_c_options::fill (*this);
+ }
+ };
+
+ void cmd_new_c_options::
+ fill (::bdep::cli::options& os)
+ {
+ // cpp
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("c++");
+ std::string dv;
+ ::bdep::cli::option o ("cpp", a, true, dv);
+ os.push_back (o);
+ }
+
+ // hxx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("hxx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // cxx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("cxx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // ixx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("ixx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // txx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("txx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // mxx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("mxx", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_c_options::
+ description ()
+ {
+ static _cli_cmd_new_c_options_desc_type _cli_cmd_new_c_options_desc_;
+ return _cli_cmd_new_c_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_c_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_c_options_map;
+
+ static _cli_cmd_new_c_options_map _cli_cmd_new_c_options_map_;
+
+ struct _cli_cmd_new_c_options_map_init
+ {
+ _cli_cmd_new_c_options_map_init ()
+ {
+ _cli_cmd_new_c_options_map_["cpp"] =
+ &::bdep::cli::thunk< cmd_new_c_options, &cmd_new_c_options::cpp_ >;
+ _cli_cmd_new_c_options_map_["c++"] =
+ &::bdep::cli::thunk< cmd_new_c_options, &cmd_new_c_options::cpp_ >;
+ _cli_cmd_new_c_options_map_["hxx"] =
+ &::bdep::cli::thunk< cmd_new_c_options, string, &cmd_new_c_options::hxx_,
+ &cmd_new_c_options::hxx_specified_ >;
+ _cli_cmd_new_c_options_map_["cxx"] =
+ &::bdep::cli::thunk< cmd_new_c_options, string, &cmd_new_c_options::cxx_,
+ &cmd_new_c_options::cxx_specified_ >;
+ _cli_cmd_new_c_options_map_["ixx"] =
+ &::bdep::cli::thunk< cmd_new_c_options, string, &cmd_new_c_options::ixx_,
+ &cmd_new_c_options::ixx_specified_ >;
+ _cli_cmd_new_c_options_map_["txx"] =
+ &::bdep::cli::thunk< cmd_new_c_options, string, &cmd_new_c_options::txx_,
+ &cmd_new_c_options::txx_specified_ >;
+ _cli_cmd_new_c_options_map_["mxx"] =
+ &::bdep::cli::thunk< cmd_new_c_options, string, &cmd_new_c_options::mxx_,
+ &cmd_new_c_options::mxx_specified_ >;
+ }
+ };
+
+ static _cli_cmd_new_c_options_map_init _cli_cmd_new_c_options_map_init_;
+
+ bool cmd_new_c_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_c_options_map::const_iterator i (_cli_cmd_new_c_options_map_.find (o));
+
+ if (i != _cli_cmd_new_c_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_c_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_cxx_options
+ //
+
+ cmd_new_cxx_options::
+ cmd_new_cxx_options ()
+ : cpp_ (),
+ extension_ (),
+ extension_specified_ (false),
+ hxx_ (),
+ hxx_specified_ (false),
+ cxx_ (),
+ cxx_specified_ (false),
+ ixx_ (),
+ ixx_specified_ (false),
+ txx_ (),
+ txx_specified_ (false),
+ mxx_ (),
+ mxx_specified_ (false),
+ c_ ()
+ {
+ }
+
+ bool cmd_new_cxx_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_cxx_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_cxx_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_cxx_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_cxx_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_cxx_options::
+ merge (const cmd_new_cxx_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.cpp_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->cpp_, a.cpp_);
+ }
+
+ if (a.extension_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->extension_, a.extension_);
+ this->extension_specified_ = true;
+ }
+
+ if (a.hxx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->hxx_, a.hxx_);
+ this->hxx_specified_ = true;
+ }
+
+ if (a.cxx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->cxx_, a.cxx_);
+ this->cxx_specified_ = true;
+ }
+
+ if (a.ixx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->ixx_, a.ixx_);
+ this->ixx_specified_ = true;
+ }
+
+ if (a.txx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->txx_, a.txx_);
+ this->txx_specified_ = true;
+ }
+
+ if (a.mxx_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->mxx_, a.mxx_);
+ this->mxx_specified_ = true;
+ }
+
+ if (a.c_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->c_, a.c_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_cxx_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_cxx_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_cxx_options_desc_type ()
+ {
+ ::bdep::cmd_new_cxx_options::fill (*this);
+ }
+ };
+
+ void cmd_new_cxx_options::
+ fill (::bdep::cli::options& os)
+ {
+ // cpp
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("cpp", a, true, dv);
+ os.push_back (o);
+ }
+
+ // extension
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("extension", a, false, dv);
+ os.push_back (o);
+ }
+
+ // hxx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("hxx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // cxx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("cxx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // ixx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("ixx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // txx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("txx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // mxx
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("mxx", a, false, dv);
+ os.push_back (o);
+ }
+
+ // c
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("c", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_cxx_options::
+ description ()
+ {
+ static _cli_cmd_new_cxx_options_desc_type _cli_cmd_new_cxx_options_desc_;
+ return _cli_cmd_new_cxx_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_cxx_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_cxx_options_map;
+
+ static _cli_cmd_new_cxx_options_map _cli_cmd_new_cxx_options_map_;
+
+ struct _cli_cmd_new_cxx_options_map_init
+ {
+ _cli_cmd_new_cxx_options_map_init ()
+ {
+ _cli_cmd_new_cxx_options_map_["cpp"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, &cmd_new_cxx_options::cpp_ >;
+ _cli_cmd_new_cxx_options_map_["extension"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, string, &cmd_new_cxx_options::extension_,
+ &cmd_new_cxx_options::extension_specified_ >;
+ _cli_cmd_new_cxx_options_map_["hxx"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, string, &cmd_new_cxx_options::hxx_,
+ &cmd_new_cxx_options::hxx_specified_ >;
+ _cli_cmd_new_cxx_options_map_["cxx"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, string, &cmd_new_cxx_options::cxx_,
+ &cmd_new_cxx_options::cxx_specified_ >;
+ _cli_cmd_new_cxx_options_map_["ixx"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, string, &cmd_new_cxx_options::ixx_,
+ &cmd_new_cxx_options::ixx_specified_ >;
+ _cli_cmd_new_cxx_options_map_["txx"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, string, &cmd_new_cxx_options::txx_,
+ &cmd_new_cxx_options::txx_specified_ >;
+ _cli_cmd_new_cxx_options_map_["mxx"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, string, &cmd_new_cxx_options::mxx_,
+ &cmd_new_cxx_options::mxx_specified_ >;
+ _cli_cmd_new_cxx_options_map_["c"] =
+ &::bdep::cli::thunk< cmd_new_cxx_options, &cmd_new_cxx_options::c_ >;
+ }
+ };
+
+ static _cli_cmd_new_cxx_options_map_init _cli_cmd_new_cxx_options_map_init_;
+
+ bool cmd_new_cxx_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_cxx_options_map::const_iterator i (_cli_cmd_new_cxx_options_map_.find (o));
+
+ if (i != _cli_cmd_new_cxx_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_cxx_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_exe_options
+ //
+
+ cmd_new_exe_options::
+ cmd_new_exe_options ()
+ : no_tests_ (),
+ unit_tests_ (),
+ no_install_ (),
+ export_stub_ (),
+ prefix_ (),
+ prefix_specified_ (false),
+ subdir_ (),
+ subdir_specified_ (false),
+ no_subdir_ (),
+ buildfile_in_prefix_ (),
+ third_party_ (),
+ license_ ("other: proprietary"),
+ license_specified_ (false),
+ no_readme_ (),
+ no_package_readme_ (),
+ alt_naming_ ()
+ {
+ }
+
+ bool cmd_new_exe_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_exe_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_exe_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_exe_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_exe_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_exe_options::
+ merge (const cmd_new_exe_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.no_tests_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_tests_, a.no_tests_);
+ }
+
+ if (a.unit_tests_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->unit_tests_, a.unit_tests_);
+ }
+
+ if (a.no_install_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_install_, a.no_install_);
+ }
+
+ if (a.export_stub_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->export_stub_, a.export_stub_);
+ }
+
+ if (a.prefix_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->prefix_, a.prefix_);
+ this->prefix_specified_ = true;
+ }
+
+ if (a.subdir_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->subdir_, a.subdir_);
+ this->subdir_specified_ = true;
+ }
+
+ if (a.no_subdir_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_subdir_, a.no_subdir_);
+ }
+
+ if (a.buildfile_in_prefix_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->buildfile_in_prefix_, a.buildfile_in_prefix_);
+ }
+
+ if (a.third_party_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->third_party_, a.third_party_);
+ }
+
+ if (a.license_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->license_, a.license_);
+ this->license_specified_ = true;
+ }
+
+ if (a.no_readme_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_readme_, a.no_readme_);
+ }
+
+ if (a.no_package_readme_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_package_readme_, a.no_package_readme_);
+ }
+
+ if (a.alt_naming_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->alt_naming_, a.alt_naming_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_exe_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_exe_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_exe_options_desc_type ()
+ {
+ ::bdep::cmd_new_exe_options::fill (*this);
+ }
+ };
+
+ void cmd_new_exe_options::
+ fill (::bdep::cli::options& os)
+ {
+ // no-tests
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-tests", a, true, dv);
+ os.push_back (o);
+ }
+
+ // unit-tests
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("unit-tests", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-install
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-install", a, true, dv);
+ os.push_back (o);
+ }
+
+ // export-stub
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("export-stub", a, true, dv);
+ os.push_back (o);
+ }
+
+ // prefix
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("prefix", a, false, dv);
+ os.push_back (o);
+ }
+
+ // subdir
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("subdir", a, false, dv);
+ os.push_back (o);
+ }
+
+ // no-subdir
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-subdir", a, true, dv);
+ os.push_back (o);
+ }
+
+ // buildfile-in-prefix
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("buildfile-in-prefix", a, true, dv);
+ os.push_back (o);
+ }
+
+ // third-party
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("third-party", a, true, dv);
+ os.push_back (o);
+ }
+
+ // license
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("other: proprietary");
+ ::bdep::cli::option o ("license", a, false, dv);
+ os.push_back (o);
+ }
+
+ // no-readme
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-readme", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-package-readme
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-package-readme", a, true, dv);
+ os.push_back (o);
+ }
+
+ // alt-naming
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("alt-naming", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_exe_options::
+ description ()
+ {
+ static _cli_cmd_new_exe_options_desc_type _cli_cmd_new_exe_options_desc_;
+ return _cli_cmd_new_exe_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_exe_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_exe_options_map;
+
+ static _cli_cmd_new_exe_options_map _cli_cmd_new_exe_options_map_;
+
+ struct _cli_cmd_new_exe_options_map_init
+ {
+ _cli_cmd_new_exe_options_map_init ()
+ {
+ _cli_cmd_new_exe_options_map_["no-tests"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::no_tests_ >;
+ _cli_cmd_new_exe_options_map_["unit-tests"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::unit_tests_ >;
+ _cli_cmd_new_exe_options_map_["no-install"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::no_install_ >;
+ _cli_cmd_new_exe_options_map_["export-stub"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::export_stub_ >;
+ _cli_cmd_new_exe_options_map_["prefix"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, dir_path, &cmd_new_exe_options::prefix_,
+ &cmd_new_exe_options::prefix_specified_ >;
+ _cli_cmd_new_exe_options_map_["subdir"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, dir_path, &cmd_new_exe_options::subdir_,
+ &cmd_new_exe_options::subdir_specified_ >;
+ _cli_cmd_new_exe_options_map_["no-subdir"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::no_subdir_ >;
+ _cli_cmd_new_exe_options_map_["buildfile-in-prefix"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::buildfile_in_prefix_ >;
+ _cli_cmd_new_exe_options_map_["third-party"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::third_party_ >;
+ _cli_cmd_new_exe_options_map_["license"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, string, &cmd_new_exe_options::license_,
+ &cmd_new_exe_options::license_specified_ >;
+ _cli_cmd_new_exe_options_map_["no-readme"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::no_readme_ >;
+ _cli_cmd_new_exe_options_map_["no-package-readme"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::no_package_readme_ >;
+ _cli_cmd_new_exe_options_map_["alt-naming"] =
+ &::bdep::cli::thunk< cmd_new_exe_options, &cmd_new_exe_options::alt_naming_ >;
+ }
+ };
+
+ static _cli_cmd_new_exe_options_map_init _cli_cmd_new_exe_options_map_init_;
+
+ bool cmd_new_exe_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_exe_options_map::const_iterator i (_cli_cmd_new_exe_options_map_.find (o));
+
+ if (i != _cli_cmd_new_exe_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_exe_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_lib_options
+ //
+
+ cmd_new_lib_options::
+ cmd_new_lib_options ()
+ : binless_ (),
+ no_tests_ (),
+ unit_tests_ (),
+ no_install_ (),
+ no_version_ (),
+ no_symexport_ (),
+ auto_symexport_ (),
+ prefix_include_ (),
+ prefix_include_specified_ (false),
+ prefix_source_ (),
+ prefix_source_specified_ (false),
+ prefix_ (),
+ prefix_specified_ (false),
+ split_ (),
+ subdir_ (),
+ subdir_specified_ (false),
+ no_subdir_include_ (),
+ no_subdir_source_ (),
+ no_subdir_ (),
+ buildfile_in_prefix_ (),
+ third_party_ (),
+ license_ ("other: proprietary"),
+ license_specified_ (false),
+ no_readme_ (),
+ no_package_readme_ (),
+ alt_naming_ ()
+ {
+ }
+
+ bool cmd_new_lib_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_lib_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_lib_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_lib_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_lib_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_lib_options::
+ merge (const cmd_new_lib_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.binless_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->binless_, a.binless_);
+ }
+
+ if (a.no_tests_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_tests_, a.no_tests_);
+ }
+
+ if (a.unit_tests_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->unit_tests_, a.unit_tests_);
+ }
+
+ if (a.no_install_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_install_, a.no_install_);
+ }
+
+ if (a.no_version_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_version_, a.no_version_);
+ }
+
+ if (a.no_symexport_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_symexport_, a.no_symexport_);
+ }
+
+ if (a.auto_symexport_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->auto_symexport_, a.auto_symexport_);
+ }
+
+ if (a.prefix_include_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->prefix_include_, a.prefix_include_);
+ this->prefix_include_specified_ = true;
+ }
+
+ if (a.prefix_source_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->prefix_source_, a.prefix_source_);
+ this->prefix_source_specified_ = true;
+ }
+
+ if (a.prefix_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->prefix_, a.prefix_);
+ this->prefix_specified_ = true;
+ }
+
+ if (a.split_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->split_, a.split_);
+ }
+
+ if (a.subdir_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->subdir_, a.subdir_);
+ this->subdir_specified_ = true;
+ }
+
+ if (a.no_subdir_include_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_subdir_include_, a.no_subdir_include_);
+ }
+
+ if (a.no_subdir_source_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_subdir_source_, a.no_subdir_source_);
+ }
+
+ if (a.no_subdir_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_subdir_, a.no_subdir_);
+ }
+
+ if (a.buildfile_in_prefix_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->buildfile_in_prefix_, a.buildfile_in_prefix_);
+ }
+
+ if (a.third_party_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->third_party_, a.third_party_);
+ }
+
+ if (a.license_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->license_, a.license_);
+ this->license_specified_ = true;
+ }
+
+ if (a.no_readme_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_readme_, a.no_readme_);
+ }
+
+ if (a.no_package_readme_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_package_readme_, a.no_package_readme_);
+ }
+
+ if (a.alt_naming_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->alt_naming_, a.alt_naming_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_lib_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_lib_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_lib_options_desc_type ()
+ {
+ ::bdep::cmd_new_lib_options::fill (*this);
+ }
+ };
+
+ void cmd_new_lib_options::
+ fill (::bdep::cli::options& os)
+ {
+ // binless
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("binless", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-tests
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-tests", a, true, dv);
+ os.push_back (o);
+ }
+
+ // unit-tests
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("unit-tests", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-install
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-install", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-version
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-version", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-symexport
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-symexport", a, true, dv);
+ os.push_back (o);
+ }
+
+ // auto-symexport
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("auto-symexport", a, true, dv);
+ os.push_back (o);
+ }
+
+ // prefix-include
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("prefix-include", a, false, dv);
+ os.push_back (o);
+ }
+
+ // prefix-source
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("prefix-source", a, false, dv);
+ os.push_back (o);
+ }
+
+ // prefix
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("prefix", a, false, dv);
+ os.push_back (o);
+ }
+
+ // split
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("split", a, true, dv);
+ os.push_back (o);
+ }
+
+ // subdir
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("subdir", a, false, dv);
+ os.push_back (o);
+ }
+
+ // no-subdir-include
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-subdir-include", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-subdir-source
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-subdir-source", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-subdir
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-subdir", a, true, dv);
+ os.push_back (o);
+ }
+
+ // buildfile-in-prefix
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("buildfile-in-prefix", a, true, dv);
+ os.push_back (o);
+ }
+
+ // third-party
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("third-party", a, true, dv);
+ os.push_back (o);
+ }
+
+ // license
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("other: proprietary");
+ ::bdep::cli::option o ("license", a, false, dv);
+ os.push_back (o);
+ }
+
+ // no-readme
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-readme", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-package-readme
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-package-readme", a, true, dv);
+ os.push_back (o);
+ }
+
+ // alt-naming
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("alt-naming", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_lib_options::
+ description ()
+ {
+ static _cli_cmd_new_lib_options_desc_type _cli_cmd_new_lib_options_desc_;
+ return _cli_cmd_new_lib_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_lib_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_lib_options_map;
+
+ static _cli_cmd_new_lib_options_map _cli_cmd_new_lib_options_map_;
+
+ struct _cli_cmd_new_lib_options_map_init
+ {
+ _cli_cmd_new_lib_options_map_init ()
+ {
+ _cli_cmd_new_lib_options_map_["binless"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::binless_ >;
+ _cli_cmd_new_lib_options_map_["no-tests"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_tests_ >;
+ _cli_cmd_new_lib_options_map_["unit-tests"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::unit_tests_ >;
+ _cli_cmd_new_lib_options_map_["no-install"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_install_ >;
+ _cli_cmd_new_lib_options_map_["no-version"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_version_ >;
+ _cli_cmd_new_lib_options_map_["no-symexport"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_symexport_ >;
+ _cli_cmd_new_lib_options_map_["auto-symexport"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::auto_symexport_ >;
+ _cli_cmd_new_lib_options_map_["prefix-include"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, dir_path, &cmd_new_lib_options::prefix_include_,
+ &cmd_new_lib_options::prefix_include_specified_ >;
+ _cli_cmd_new_lib_options_map_["prefix-source"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, dir_path, &cmd_new_lib_options::prefix_source_,
+ &cmd_new_lib_options::prefix_source_specified_ >;
+ _cli_cmd_new_lib_options_map_["prefix"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, dir_path, &cmd_new_lib_options::prefix_,
+ &cmd_new_lib_options::prefix_specified_ >;
+ _cli_cmd_new_lib_options_map_["split"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::split_ >;
+ _cli_cmd_new_lib_options_map_["subdir"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, dir_path, &cmd_new_lib_options::subdir_,
+ &cmd_new_lib_options::subdir_specified_ >;
+ _cli_cmd_new_lib_options_map_["no-subdir-include"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_subdir_include_ >;
+ _cli_cmd_new_lib_options_map_["no-subdir-source"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_subdir_source_ >;
+ _cli_cmd_new_lib_options_map_["no-subdir"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_subdir_ >;
+ _cli_cmd_new_lib_options_map_["buildfile-in-prefix"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::buildfile_in_prefix_ >;
+ _cli_cmd_new_lib_options_map_["third-party"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::third_party_ >;
+ _cli_cmd_new_lib_options_map_["license"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, string, &cmd_new_lib_options::license_,
+ &cmd_new_lib_options::license_specified_ >;
+ _cli_cmd_new_lib_options_map_["no-readme"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_readme_ >;
+ _cli_cmd_new_lib_options_map_["no-package-readme"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::no_package_readme_ >;
+ _cli_cmd_new_lib_options_map_["alt-naming"] =
+ &::bdep::cli::thunk< cmd_new_lib_options, &cmd_new_lib_options::alt_naming_ >;
+ }
+ };
+
+ static _cli_cmd_new_lib_options_map_init _cli_cmd_new_lib_options_map_init_;
+
+ bool cmd_new_lib_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_lib_options_map::const_iterator i (_cli_cmd_new_lib_options_map_.find (o));
+
+ if (i != _cli_cmd_new_lib_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_lib_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_bare_options
+ //
+
+ cmd_new_bare_options::
+ cmd_new_bare_options ()
+ : no_tests_ (),
+ no_install_ (),
+ license_ ("other: proprietary"),
+ license_specified_ (false),
+ no_readme_ (),
+ alt_naming_ ()
+ {
+ }
+
+ bool cmd_new_bare_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_bare_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_bare_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_bare_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_bare_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_bare_options::
+ merge (const cmd_new_bare_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.no_tests_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_tests_, a.no_tests_);
+ }
+
+ if (a.no_install_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_install_, a.no_install_);
+ }
+
+ if (a.license_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->license_, a.license_);
+ this->license_specified_ = true;
+ }
+
+ if (a.no_readme_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_readme_, a.no_readme_);
+ }
+
+ if (a.alt_naming_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->alt_naming_, a.alt_naming_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_bare_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_bare_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_bare_options_desc_type ()
+ {
+ ::bdep::cmd_new_bare_options::fill (*this);
+ }
+ };
+
+ void cmd_new_bare_options::
+ fill (::bdep::cli::options& os)
+ {
+ // no-tests
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-tests", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-install
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-install", a, true, dv);
+ os.push_back (o);
+ }
+
+ // license
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("other: proprietary");
+ ::bdep::cli::option o ("license", a, false, dv);
+ os.push_back (o);
+ }
+
+ // no-readme
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-readme", a, true, dv);
+ os.push_back (o);
+ }
+
+ // alt-naming
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("alt-naming", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_bare_options::
+ description ()
+ {
+ static _cli_cmd_new_bare_options_desc_type _cli_cmd_new_bare_options_desc_;
+ return _cli_cmd_new_bare_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_bare_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_bare_options_map;
+
+ static _cli_cmd_new_bare_options_map _cli_cmd_new_bare_options_map_;
+
+ struct _cli_cmd_new_bare_options_map_init
+ {
+ _cli_cmd_new_bare_options_map_init ()
+ {
+ _cli_cmd_new_bare_options_map_["no-tests"] =
+ &::bdep::cli::thunk< cmd_new_bare_options, &cmd_new_bare_options::no_tests_ >;
+ _cli_cmd_new_bare_options_map_["no-install"] =
+ &::bdep::cli::thunk< cmd_new_bare_options, &cmd_new_bare_options::no_install_ >;
+ _cli_cmd_new_bare_options_map_["license"] =
+ &::bdep::cli::thunk< cmd_new_bare_options, string, &cmd_new_bare_options::license_,
+ &cmd_new_bare_options::license_specified_ >;
+ _cli_cmd_new_bare_options_map_["no-readme"] =
+ &::bdep::cli::thunk< cmd_new_bare_options, &cmd_new_bare_options::no_readme_ >;
+ _cli_cmd_new_bare_options_map_["alt-naming"] =
+ &::bdep::cli::thunk< cmd_new_bare_options, &cmd_new_bare_options::alt_naming_ >;
+ }
+ };
+
+ static _cli_cmd_new_bare_options_map_init _cli_cmd_new_bare_options_map_init_;
+
+ bool cmd_new_bare_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_bare_options_map::const_iterator i (_cli_cmd_new_bare_options_map_.find (o));
+
+ if (i != _cli_cmd_new_bare_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_bare_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_empty_options
+ //
+
+ cmd_new_empty_options::
+ cmd_new_empty_options ()
+ : third_party_ (),
+ no_readme_ ()
+ {
+ }
+
+ bool cmd_new_empty_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_empty_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_empty_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_empty_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_empty_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_empty_options::
+ merge (const cmd_new_empty_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.third_party_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->third_party_, a.third_party_);
+ }
+
+ if (a.no_readme_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_readme_, a.no_readme_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_empty_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_empty_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_empty_options_desc_type ()
+ {
+ ::bdep::cmd_new_empty_options::fill (*this);
+ }
+ };
+
+ void cmd_new_empty_options::
+ fill (::bdep::cli::options& os)
+ {
+ // third-party
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("third-party", a, true, dv);
+ os.push_back (o);
+ }
+
+ // no-readme
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("no-readme", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_empty_options::
+ description ()
+ {
+ static _cli_cmd_new_empty_options_desc_type _cli_cmd_new_empty_options_desc_;
+ return _cli_cmd_new_empty_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_empty_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_empty_options_map;
+
+ static _cli_cmd_new_empty_options_map _cli_cmd_new_empty_options_map_;
+
+ struct _cli_cmd_new_empty_options_map_init
+ {
+ _cli_cmd_new_empty_options_map_init ()
+ {
+ _cli_cmd_new_empty_options_map_["third-party"] =
+ &::bdep::cli::thunk< cmd_new_empty_options, &cmd_new_empty_options::third_party_ >;
+ _cli_cmd_new_empty_options_map_["no-readme"] =
+ &::bdep::cli::thunk< cmd_new_empty_options, &cmd_new_empty_options::no_readme_ >;
+ }
+ };
+
+ static _cli_cmd_new_empty_options_map_init _cli_cmd_new_empty_options_map_init_;
+
+ bool cmd_new_empty_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_empty_options_map::const_iterator i (_cli_cmd_new_empty_options_map_.find (o));
+
+ if (i != _cli_cmd_new_empty_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_empty_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_git_options
+ //
+
+ cmd_new_git_options::
+ cmd_new_git_options ()
+ : branch_ (),
+ branch_specified_ (false)
+ {
+ }
+
+ bool cmd_new_git_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_git_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_git_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_git_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_git_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_git_options::
+ merge (const cmd_new_git_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.branch_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->branch_, a.branch_);
+ this->branch_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_git_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_git_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_git_options_desc_type ()
+ {
+ ::bdep::cmd_new_git_options::fill (*this);
+ }
+ };
+
+ void cmd_new_git_options::
+ fill (::bdep::cli::options& os)
+ {
+ // branch
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("branch", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_git_options::
+ description ()
+ {
+ static _cli_cmd_new_git_options_desc_type _cli_cmd_new_git_options_desc_;
+ return _cli_cmd_new_git_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_git_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_git_options_map;
+
+ static _cli_cmd_new_git_options_map _cli_cmd_new_git_options_map_;
+
+ struct _cli_cmd_new_git_options_map_init
+ {
+ _cli_cmd_new_git_options_map_init ()
+ {
+ _cli_cmd_new_git_options_map_["branch"] =
+ &::bdep::cli::thunk< cmd_new_git_options, string, &cmd_new_git_options::branch_,
+ &cmd_new_git_options::branch_specified_ >;
+ }
+ };
+
+ static _cli_cmd_new_git_options_map_init _cli_cmd_new_git_options_map_init_;
+
+ bool cmd_new_git_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_git_options_map::const_iterator i (_cli_cmd_new_git_options_map_.find (o));
+
+ if (i != _cli_cmd_new_git_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_git_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_none_options
+ //
+
+ cmd_new_none_options::
+ cmd_new_none_options ()
+ {
+ }
+
+ bool cmd_new_none_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_none_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_none_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_none_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_none_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_none_options::
+ merge (const cmd_new_none_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+ }
+
+ ::bdep::cli::usage_para cmd_new_none_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_none_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_none_options_desc_type ()
+ {
+ ::bdep::cmd_new_none_options::fill (*this);
+ }
+ };
+
+ void cmd_new_none_options::
+ fill (::bdep::cli::options&)
+ {
+ }
+
+ const ::bdep::cli::options& cmd_new_none_options::
+ description ()
+ {
+ static _cli_cmd_new_none_options_desc_type _cli_cmd_new_none_options_desc_;
+ return _cli_cmd_new_none_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_none_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_none_options_map;
+
+ static _cli_cmd_new_none_options_map _cli_cmd_new_none_options_map_;
+
+ struct _cli_cmd_new_none_options_map_init
+ {
+ _cli_cmd_new_none_options_map_init ()
+ {
+ }
+ };
+
+ static _cli_cmd_new_none_options_map_init _cli_cmd_new_none_options_map_init_;
+
+ bool cmd_new_none_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_none_options_map::const_iterator i (_cli_cmd_new_none_options_map_.find (o));
+
+ if (i != _cli_cmd_new_none_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_new_none_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_new_options
+ //
+
+ cmd_new_options::
+ cmd_new_options ()
+ : no_init_ (),
+ package_ (),
+ source_ (),
+ output_dir_ (),
+ output_dir_specified_ (false),
+ directory_ (),
+ directory_specified_ (false),
+ type_ (),
+ type_specified_ (false),
+ lang_ (),
+ lang_specified_ (false),
+ vcs_ (),
+ vcs_specified_ (false),
+ pre_hook_ (),
+ pre_hook_specified_ (false),
+ post_hook_ (),
+ post_hook_specified_ (false),
+ no_amalgamation_ (),
+ no_checks_ (),
+ config_add_ (),
+ config_add_specified_ (false),
+ config_create_ (),
+ config_create_specified_ (false)
+ {
+ }
+
+ bool cmd_new_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_new_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_new_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_new_options::
+ merge (const cmd_new_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // configuration_add_options base
+ //
+ ::bdep::configuration_add_options::merge (a);
+
+ // configuration_name_options base
+ //
+ ::bdep::configuration_name_options::merge (a);
+
+ if (a.no_init_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_init_, a.no_init_);
+ }
+
+ if (a.package_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->package_, a.package_);
+ }
+
+ if (a.source_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->source_, a.source_);
+ }
+
+ if (a.output_dir_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->output_dir_, a.output_dir_);
+ this->output_dir_specified_ = true;
+ }
+
+ if (a.directory_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->directory_, a.directory_);
+ this->directory_specified_ = true;
+ }
+
+ if (a.type_specified_)
+ {
+ ::bdep::cli::parser< cmd_new_type>::merge (
+ this->type_, a.type_);
+ this->type_specified_ = true;
+ }
+
+ if (a.lang_specified_)
+ {
+ ::bdep::cli::parser< cmd_new_lang>::merge (
+ this->lang_, a.lang_);
+ this->lang_specified_ = true;
+ }
+
+ if (a.vcs_specified_)
+ {
+ ::bdep::cli::parser< cmd_new_vcs>::merge (
+ this->vcs_, a.vcs_);
+ this->vcs_specified_ = true;
+ }
+
+ if (a.pre_hook_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->pre_hook_, a.pre_hook_);
+ this->pre_hook_specified_ = true;
+ }
+
+ if (a.post_hook_specified_)
+ {
+ ::bdep::cli::parser< strings>::merge (
+ this->post_hook_, a.post_hook_);
+ this->post_hook_specified_ = true;
+ }
+
+ if (a.no_amalgamation_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_amalgamation_, a.no_amalgamation_);
+ }
+
+ if (a.no_checks_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_checks_, a.no_checks_);
+ }
+
+ if (a.config_add_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->config_add_, a.config_add_);
+ this->config_add_specified_ = true;
+ }
+
+ if (a.config_create_specified_)
+ {
+ ::bdep::cli::parser< dir_path>::merge (
+ this->config_create_, a.config_create_);
+ this->config_create_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_new_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mNEW OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-init\033[0m Don't initialize an empty build configuration set." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--package\033[0m Create a new package inside an already existing" << ::std::endl
+ << " project rather than a new project." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--source\033[0m Create a new source subdirectory inside an already" << ::std::endl
+ << " existing project or package rather than a new" << ::std::endl
+ << " project." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--output-dir\033[0m|\033[1m-o\033[0m \033[4mdir\033[0m Create the project, package, or source subdirectory" << ::std::endl
+ << " in the specified directory." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mdir\033[0m Assume the project/package is in the specified" << ::std::endl
+ << " directory rather than in the current working" << ::std::endl
+ << " directory. Only used with \033[1m--package\033[0m or \033[1m--source\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--type\033[0m|\033[1m-t\033[0m \033[4mtype\033[0m[,\033[4mopt\033[0m...] Specify project type and options. Valid values for" << ::std::endl
+ << " \033[4mtype\033[0m are \033[1mexe\033[0m (executable project, default), \033[1mlib\033[0m" << ::std::endl
+ << " (library project), \033[1mbare\033[0m (bare project without any" << ::std::endl
+ << " source code), and \033[1mempty\033[0m (empty project ready to be" << ::std::endl
+ << " filled with packages). Valid values for \033[4mopt\033[0m are" << ::std::endl
+ << " type-specific." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--lang\033[0m|\033[1m-l\033[0m \033[4mlang\033[0m[,\033[4mopt\033[0m...] Specify project language and options. Valid values" << ::std::endl
+ << " for \033[4mlang\033[0m are \033[1mc\033[0m and \033[1mc++\033[0m (default). Valid values for" << ::std::endl
+ << " \033[4mopt\033[0m are language-specific." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--vcs\033[0m|\033[1m-s\033[0m \033[4mvcs\033[0m[,\033[4mopt\033[0m...] Specify project version control system and options." << ::std::endl
+ << " Valid values for \033[4mvcs\033[0m are \033[1mgit\033[0m (default) and \033[1mnone\033[0m." << ::std::endl
+ << " Valid values for \033[4mopt\033[0m are system-specific." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--pre-hook\033[0m \033[4mcommand\033[0m" << std::endl;
+
+ os << std::endl
+ << "\033[1m--post-hook\033[0m \033[4mcommand\033[0m Run the specified command before/after creating the" << ::std::endl
+ << " project, package, or source directory." << ::std::endl
+ << ::std::endl
+ << " The \033[4mcommand\033[0m value is interpreted as a" << ::std::endl
+ << " whitespace-separated, potentially quoted command line" << ::std::endl
+ << " consisting of a program or a portable builtin" << ::std::endl
+ << " (testscript#builtins) optionally followed by" << ::std::endl
+ << " arguments and redirects. Specifically, a single level" << ::std::endl
+ << " of quotes (either single or double) is removed and" << ::std::endl
+ << " whitespaces are not treated as separators inside such" << ::std::endl
+ << " quoted fragments. Currently only the \033[1mstdout\033[0m redirect" << ::std::endl
+ << " to a file is supported. For example:" << ::std::endl
+ << ::std::endl
+ << " $ bdep new --post-hook \"echo '.idea/ # IDE'" << ::std::endl
+ << " >>.gitignore\" hello" << ::std::endl
+ << ::std::endl
+ << " The command line elements (program, arguments, etc)" << ::std::endl
+ << " may optionally contain substitutions -- variable" << ::std::endl
+ << " names enclosed with the \033[1m@\033[0m substitution symbol --" << ::std::endl
+ << " which are replaced with the corresponding variable" << ::std::endl
+ << " values to produce the actual command. The following" << ::std::endl
+ << " variable names are recognized with the double" << ::std::endl
+ << " substitution symbol (\033[1m@@\033[0m) serving as an escape" << ::std::endl
+ << " sequence." << ::std::endl
+ << ::std::endl
+ << " @mode@ - one of 'project', 'package', or 'source'" << ::std::endl
+ << " @name@ - project, package, or source subdirectory" << ::std::endl
+ << " name" << ::std::endl
+ << " @base@ - name base (name without extension)" << ::std::endl
+ << " @stem@ - name stem (name base without 'lib' prefix)" << ::std::endl
+ << " @root@ - project/package root directory" << ::std::endl
+ << " @pfx@ - combined prefix relative to project/package" << ::std::endl
+ << " root" << ::std::endl
+ << " @inc@ - split header prefix relative to" << ::std::endl
+ << " project/package root" << ::std::endl
+ << " @src@ - split source prefix relative to" << ::std::endl
+ << " project/package root" << ::std::endl
+ << " @sub@ - source subdirectory relative to" << ::std::endl
+ << " header/source prefix" << ::std::endl
+ << " @type@ - type (--type|-t value: 'exe', 'lib', etc)" << ::std::endl
+ << " @lang@ - language (--lang|-l value: 'c', 'c++', etc)" << ::std::endl
+ << " @vcs@ - version control system (--vcs|-s value:" << ::std::endl
+ << " 'git', etc)" << ::std::endl
+ << ::std::endl
+ << " Note that the \033[1m@inc@\033[0m and \033[1m@src@\033[0m variables are only set" << ::std::endl
+ << " if the header/source prefix is split with the" << ::std::endl
+ << " combined \033[1m@pfx@\033[0m variable set otherwise." << ::std::endl
+ << ::std::endl
+ << " For example:" << ::std::endl
+ << ::std::endl
+ << " $ bdep new --post-hook \"echo bin/" << ::std::endl
+ << " >>@name@/.gitignore\" hello" << ::std::endl
+ << ::std::endl
+ << " These substitution variables are also made available" << ::std::endl
+ << " to the hook program as the \033[1mBDEP_NEW_*\033[0m environment" << ::std::endl
+ << " variables (\033[1mBDEP_NEW_MODE\033[0m, \033[1mBDEP_NEW_NAME\033[0m, etc)." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-amalgamation\033[0m Create a project with disabled amalgamation support." << ::std::endl
+ << " This option is normally only used for testing." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-checks\033[0m Suppress nested project/package checks. This option" << ::std::endl
+ << " is normally only used for testing." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--config-add\033[0m|\033[1m-A\033[0m \033[4mdir\033[0m Add an existing build configuration \033[4mdir\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--config-create\033[0m|\033[1m-C\033[0m \033[4mdir\033[0m Create a new build configuration in \033[4mdir\033[0m." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // configuration_add_options base
+ //
+ p = ::bdep::configuration_add_options::print_usage (os, p);
+
+ // configuration_name_options base
+ //
+ p = ::bdep::configuration_name_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_new_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_new_options_desc_type ()
+ {
+ ::bdep::cmd_new_options::fill (*this);
+ }
+ };
+
+ void cmd_new_options::
+ fill (::bdep::cli::options& os)
+ {
+ // configuration_add_options base
+ //
+ ::bdep::configuration_add_options::fill (os);
+
+ // configuration_name_options base
+ //
+ ::bdep::configuration_name_options::fill (os);
+
+ // --no-init
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-init", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --package
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--package", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --source
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--source", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --output-dir
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-o");
+ std::string dv;
+ ::bdep::cli::option o ("--output-dir", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --directory
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-d");
+ std::string dv;
+ ::bdep::cli::option o ("--directory", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --type
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-t");
+ std::string dv;
+ ::bdep::cli::option o ("--type", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --lang
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-l");
+ std::string dv;
+ ::bdep::cli::option o ("--lang", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --vcs
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-s");
+ std::string dv;
+ ::bdep::cli::option o ("--vcs", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --pre-hook
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--pre-hook", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --post-hook
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--post-hook", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --no-amalgamation
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-amalgamation", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-checks
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-checks", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --config-add
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-A");
+ std::string dv;
+ ::bdep::cli::option o ("--config-add", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --config-create
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-C");
+ std::string dv;
+ ::bdep::cli::option o ("--config-create", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_new_options::
+ description ()
+ {
+ static _cli_cmd_new_options_desc_type _cli_cmd_new_options_desc_;
+ return _cli_cmd_new_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_new_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_new_options_map;
+
+ static _cli_cmd_new_options_map _cli_cmd_new_options_map_;
+
+ struct _cli_cmd_new_options_map_init
+ {
+ _cli_cmd_new_options_map_init ()
+ {
+ _cli_cmd_new_options_map_["--no-init"] =
+ &::bdep::cli::thunk< cmd_new_options, &cmd_new_options::no_init_ >;
+ _cli_cmd_new_options_map_["--package"] =
+ &::bdep::cli::thunk< cmd_new_options, &cmd_new_options::package_ >;
+ _cli_cmd_new_options_map_["--source"] =
+ &::bdep::cli::thunk< cmd_new_options, &cmd_new_options::source_ >;
+ _cli_cmd_new_options_map_["--output-dir"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::output_dir_,
+ &cmd_new_options::output_dir_specified_ >;
+ _cli_cmd_new_options_map_["-o"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::output_dir_,
+ &cmd_new_options::output_dir_specified_ >;
+ _cli_cmd_new_options_map_["--directory"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::directory_,
+ &cmd_new_options::directory_specified_ >;
+ _cli_cmd_new_options_map_["-d"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::directory_,
+ &cmd_new_options::directory_specified_ >;
+ _cli_cmd_new_options_map_["--type"] =
+ &::bdep::cli::thunk< cmd_new_options, cmd_new_type, &cmd_new_options::type_,
+ &cmd_new_options::type_specified_ >;
+ _cli_cmd_new_options_map_["-t"] =
+ &::bdep::cli::thunk< cmd_new_options, cmd_new_type, &cmd_new_options::type_,
+ &cmd_new_options::type_specified_ >;
+ _cli_cmd_new_options_map_["--lang"] =
+ &::bdep::cli::thunk< cmd_new_options, cmd_new_lang, &cmd_new_options::lang_,
+ &cmd_new_options::lang_specified_ >;
+ _cli_cmd_new_options_map_["-l"] =
+ &::bdep::cli::thunk< cmd_new_options, cmd_new_lang, &cmd_new_options::lang_,
+ &cmd_new_options::lang_specified_ >;
+ _cli_cmd_new_options_map_["--vcs"] =
+ &::bdep::cli::thunk< cmd_new_options, cmd_new_vcs, &cmd_new_options::vcs_,
+ &cmd_new_options::vcs_specified_ >;
+ _cli_cmd_new_options_map_["-s"] =
+ &::bdep::cli::thunk< cmd_new_options, cmd_new_vcs, &cmd_new_options::vcs_,
+ &cmd_new_options::vcs_specified_ >;
+ _cli_cmd_new_options_map_["--pre-hook"] =
+ &::bdep::cli::thunk< cmd_new_options, strings, &cmd_new_options::pre_hook_,
+ &cmd_new_options::pre_hook_specified_ >;
+ _cli_cmd_new_options_map_["--post-hook"] =
+ &::bdep::cli::thunk< cmd_new_options, strings, &cmd_new_options::post_hook_,
+ &cmd_new_options::post_hook_specified_ >;
+ _cli_cmd_new_options_map_["--no-amalgamation"] =
+ &::bdep::cli::thunk< cmd_new_options, &cmd_new_options::no_amalgamation_ >;
+ _cli_cmd_new_options_map_["--no-checks"] =
+ &::bdep::cli::thunk< cmd_new_options, &cmd_new_options::no_checks_ >;
+ _cli_cmd_new_options_map_["--config-add"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::config_add_,
+ &cmd_new_options::config_add_specified_ >;
+ _cli_cmd_new_options_map_["-A"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::config_add_,
+ &cmd_new_options::config_add_specified_ >;
+ _cli_cmd_new_options_map_["--config-create"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::config_create_,
+ &cmd_new_options::config_create_specified_ >;
+ _cli_cmd_new_options_map_["-C"] =
+ &::bdep::cli::thunk< cmd_new_options, dir_path, &cmd_new_options::config_create_,
+ &cmd_new_options::config_create_specified_ >;
+ }
+ };
+
+ static _cli_cmd_new_options_map_init _cli_cmd_new_options_map_init_;
+
+ bool cmd_new_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_new_options_map::const_iterator i (_cli_cmd_new_options_map_.find (o));
+
+ if (i != _cli_cmd_new_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // configuration_add_options base
+ //
+ if (::bdep::configuration_add_options::_parse (o, s))
+ return true;
+
+ // configuration_name_options base
+ //
+ if (::bdep::configuration_name_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_new_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_new_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep new\033[0m [\033[4moptions\033[0m] [\033[1m--no-init\033[0m] \033[4mspec\033[0m [\033[4mname\033[0m]" << ::std::endl
+ << "\033[1mbdep new\033[0m [\033[4moptions\033[0m] \033[1m--config-add|-A\033[0m \033[4mcfg-dir\033[0m [\033[1m@\033[0m\033[4mcfg-name\033[0m] \033[4mspec\033[0m [\033[4mname\033[0m]" << ::std::endl
+ << "\033[1mbdep new\033[0m [\033[4moptions\033[0m] \033[1m--config-create|-C\033[0m \033[4mcfg-dir\033[0m [\033[1m@\033[0m\033[4mcfg-name\033[0m] \033[4mspec\033[0m [\033[4mname\033[0m]" << ::std::endl
+ << " [\033[4mcfg-args\033[0m]" << ::std::endl
+ << "\033[1mbdep new\033[0m [\033[4moptions\033[0m] \033[1m--package\033[0m [\033[4mprj-spec\033[0m] \033[4mspec\033[0m [\033[4mname\033[0m]" << ::std::endl
+ << "\033[1mbdep new\033[0m [\033[4moptions\033[0m] \033[1m--source\033[0m [\033[4mprj-spec\033[0m] \033[4mspec\033[0m [\033[4mname\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mspec\033[0m = [\033[4mlang\033[0m] [\033[4mtype\033[0m] [\033[4mvcs\033[0m]" << ::std::endl
+ << "\033[4mlang\033[0m = \033[1m--lang\033[0m|\033[1m-l\033[0m (\033[1mc\033[0m|\033[1mc++\033[0m)[\033[1m,\033[0m\033[4mlang-opt\033[0m...]" << ::std::endl
+ << "\033[4mtype\033[0m = \033[1m--type\033[0m|\033[1m-t\033[0m (\033[1mexe\033[0m|\033[1mlib\033[0m|\033[1mbare\033[0m|\033[1mempty\033[0m)[\033[1m,\033[0m\033[4mtype-opt\033[0m...]" << ::std::endl
+ << "\033[4mvcs\033[0m = \033[1m--vcs\033[0m|\033[1m-s\033[0m (\033[1mgit\033[0m|\033[1mnone\033[0m)[\033[1m,\033[0m\033[4mvcs-opt\033[0m...]" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m" << ::std::endl
+ << "\033[4mcfg-args\033[0m = [\033[1m--\033[0m [\033[4mbpkg-options\033[0m]] [\033[1m--existing\033[0m|\033[1m-e\033[0m | (\033[4mmodule\033[0m | \033[4mcfg-var\033[0m)...]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mnew\033[0m command creates and initializes a new project (the first three forms)," << ::std::endl
+ << "a new package in an already existing project (the \033[1m--package\033[0m form), or a new" << ::std::endl
+ << "source subdirectory in an already existing project/package (the \033[1m--source\033[0m form)." << ::std::endl
+ << "All the forms except \033[1m--source\033[0m first create according to \033[4mspec\033[0m a new \033[1mbuild2\033[0m" << ::std::endl
+ << "project/package called \033[4mname\033[0m in the \033[4mname\033[0m subdirectory of the current working" << ::std::endl
+ << "directory (unless overridden with \033[1m--output-dir\033[0m|\033[1m-o\033[0m\033[0m or, in case of \033[1m--package\033[0m," << ::std::endl
+ << "with \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m). If \033[4mname\033[0m contains a directory component, then the" << ::std::endl
+ << "project/package is created in this directory, as if it was specified with" << ::std::endl
+ << "\033[1m--output-dir\033[0m|\033[1m-o\033[0m\033[0m." << ::std::endl
+ << ::std::endl
+ << "The first form then, unless the \033[1m--no-init\033[0m option is specified, initializes an" << ::std::endl
+ << "empty project database as if by executing the \033[1mbdep-init(1)\033[0m command with the" << ::std::endl
+ << "\033[1m--empty\033[0m option. For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t exe hello" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "|-- hello/" << ::std::endl
+ << "| |-- hello.cxx" << ::std::endl
+ << "| `-- buildfile" << ::std::endl
+ << "|-- buildfile" << ::std::endl
+ << "`-- manifest" << ::std::endl
+ << ::std::endl
+ << "Similarly, the second and third forms add an existing or create a new build" << ::std::endl
+ << "configuration and then initialize the project in that configuration as if by" << ::std::endl
+ << "executing the \033[1mbdep-init(1)\033[0m command with the \033[1m--config-add\033[0m or \033[1m--config-create\033[0m" << ::std::endl
+ << "option, respectively. For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t exe -C @gcc hello cc config.cxx=g++" << ::std::endl
+ << ::std::endl
+ << "The \033[1m--package\033[0m form adds the new package to the \033[1mpackages.manifest\033[0m file creating" << ::std::endl
+ << "it if necessary. If no project directory is explicitly specified with" << ::std::endl
+ << "\033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m, then it will be deduced from the current working directory (see" << ::std::endl
+ << "\033[1mbdep-projects-configs(1)\033[0m for details on specifying projects). Note that nested" << ::std::endl
+ << "packages are not allowed. For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -t empty hello" << ::std::endl
+ << "$ cd hello" << ::std::endl
+ << ::std::endl
+ << "$ bdep new --package -l c++ -t lib libhello" << ::std::endl
+ << "$ bdep new --package -l c++ -t exe hello" << ::std::endl
+ << ::std::endl
+ << "$ bdep init -C @gcc cc config.cxx=g++" << ::std::endl
+ << ::std::endl
+ << "$ cd .." << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "|-- hello/" << ::std::endl
+ << "| |-- hello/" << ::std::endl
+ << "| | |-- hello.cxx" << ::std::endl
+ << "| | `-- buildfile" << ::std::endl
+ << "| |-- buildfile" << ::std::endl
+ << "| `-- manifest" << ::std::endl
+ << "|-- libhello/" << ::std::endl
+ << "| |-- libhello/" << ::std::endl
+ << "| | |-- hello.hxx" << ::std::endl
+ << "| | |-- hello.cxx" << ::std::endl
+ << "| | `-- buildfile" << ::std::endl
+ << "| |-- buildfile" << ::std::endl
+ << "| `-- manifest" << ::std::endl
+ << "`-- packages.manifest" << ::std::endl
+ << ::std::endl
+ << "The \033[1m--source\033[0m form operates \033[4mas-if\033[0m by first creating according to \033[4mspec\033[0m a" << ::std::endl
+ << "temporary project called \033[4mname\033[0m and then copying its source subdirectory" << ::std::endl
+ << "(\033[4mname\033[0m\033[1m/\033[0m\033[4mname\033[0m\033[1m/\033[0m\033[0m by default) over to the current working directory (unless" << ::std::endl
+ << "overridden with \033[1m--output-dir\033[0m|\033[1m-o\033[0m\033[0m). If no project/package directory is explicitly" << ::std::endl
+ << "specified with \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m, then the current working directory is assumed." << ::std::endl
+ << "For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t bare hello" << ::std::endl
+ << "$ cd hello" << ::std::endl
+ << ::std::endl
+ << "$ bdep new --source -l c++ -t lib libhello" << ::std::endl
+ << "$ bdep new --source -l c++ -t exe hello" << ::std::endl
+ << ::std::endl
+ << "$ bdep init -C @gcc cc config.cxx=g++" << ::std::endl
+ << ::std::endl
+ << "$ cd .." << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "|-- hello/" << ::std::endl
+ << "| |-- hello.cxx" << ::std::endl
+ << "| `-- buildfile" << ::std::endl
+ << "|-- libhello/" << ::std::endl
+ << "| |-- hello.hxx" << ::std::endl
+ << "| |-- hello.cxx" << ::std::endl
+ << "| `-- buildfile" << ::std::endl
+ << "|-- buildfile" << ::std::endl
+ << "`-- manifest" << ::std::endl
+ << ::std::endl
+ << "In all the forms, if \033[4mname\033[0m is omitted, then the current working directory name" << ::std::endl
+ << "(unless overridden with \033[1m--output-dir\033[0m|\033[1m-o\033[0m\033[0m) is used as the project/package/source" << ::std::endl
+ << "subdirectory name. See Package Name (bpkg#package-name) for details on" << ::std::endl
+ << "project/package names." << ::std::endl
+ << ::std::endl
+ << "The source subdirectory can be customized with the \033[1msubdir\033[0m project type" << ::std::endl
+ << "sub-option (see below for details). For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,subdir=libhello/io libhello-io" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello-io/" << ::std::endl
+ << "libhello-io/" << ::std::endl
+ << "`-- libhello/" << ::std::endl
+ << " `-- io/" << ::std::endl
+ << " |-- hello-io.hxx" << ::std::endl
+ << " `-- hello-io.cxx" << ::std::endl
+ << ::std::endl
+ << "By default the source subdirectory is created in the project/package root" << ::std::endl
+ << "directory and contains both headers (including public headers for libraries) as" << ::std::endl
+ << "well as sources. This can be customized in a number of ways using the \033[1mprefix*\033[0m" << ::std::endl
+ << "and \033[1msplit\033[0m project type sub-options (see below for details). For example, to" << ::std::endl
+ << "move the source subdirectory inside \033[1msrc/\033[0m:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t exe,prefix=src hello" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- hello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "And to split the library source subdirectory into public headers and other" << ::std::endl
+ << "source files:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,split libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- include/" << ::std::endl
+ << "| `-- libhello/" << ::std::endl
+ << "| `-- hello.hxx" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- libhello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "See the SOURCE LAYOUT section below for details and more examples." << ::std::endl
+ << ::std::endl
+ << "The output directory may already contain existing files provided they don't" << ::std::endl
+ << "clash with the files to be created. The \033[1mnew\033[0m command also recognizes certain" << ::std::endl
+ << "well-known files and tries to use the extracted information in the package" << ::std::endl
+ << "\033[1mmanifest\033[0m file. Specifically, it tries to guess the license from the \033[1mLICENSE\033[0m" << ::std::endl
+ << "file as well as extract the summary from \033[1mREADME.md\033[0m. This allows for the" << ::std::endl
+ << "following workflow:" << ::std::endl
+ << ::std::endl
+ << "# Create a project with LICENSE and README.md on one of the Git" << ::std::endl
+ << "# hosting services (GitHub, GitLab, etc)." << ::std::endl
+ << ::std::endl
+ << "$ git clone .../libhello.git" << ::std::endl
+ << "$ cd libhello" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib" << ::std::endl
+ << ::std::endl
+ << "The project parameters such as language, type (executable, library, etc), and" << ::std::endl
+ << "version control system can be customized as described next. Some of these" << ::std::endl
+ << "parameters also support parameter-specific sub-options (such as the file" << ::std::endl
+ << "extensions to use in a C++ project) that can be specified with a comma after" << ::std::endl
+ << "the parameter value." << ::std::endl
+ << ::std::endl
+ << "The project language can be specified with the \033[1m--lang\033[0m|\033[1m-l\033[0m\033[0m option. Valid values" << ::std::endl
+ << "for this option and their semantics are described next. If unspecified, a C++" << ::std::endl
+ << "project is created by default." << ::std::endl
+ << ::std::endl
+ << "\033[1mc\033[0m" << ::std::endl
+ << " A C project. Recognized language sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mc++\033[0m" << ::std::endl
+ << " A C project that can also use C++. If specified, then the \033[1mhxx\033[0m, \033[1mcxx\033[0m, \033[1mixx\033[0m," << ::std::endl
+ << " \033[1mtxx\033[0m, and \033[1mmxx\033[0m \033[1mc++\033[0m language sub-options can also be specified." << ::std::endl
+ << ::std::endl
+ << "\033[1mc++\033[0m" << ::std::endl
+ << " A C++ project. Recognized language sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mcpp\033[0m" << ::std::endl
+ << " Use the \033[1m.cpp\033[0m, \033[1m.hpp\033[0m, \033[1m.ipp\033[0m, \033[1m.tpp\033[0m, and \033[1m.mpp\033[0m source file extensions (alias for" << ::std::endl
+ << " \033[1mextension=?pp\033[0m)." << ::std::endl
+ << ::std::endl
+ << " \033[1mextension=\033[0m\033[4mpattern\033[0m\033[0m" << ::std::endl
+ << " Derive source file extensions from \033[4mpattern\033[0m by replacing every \033[1m?\033[0m with one of" << ::std::endl
+ << " the \033[1mc\033[0m (source), \033[1mh\033[0m (header), \033[1mi\033[0m (inline), \033[1mt\033[0m (template), or \033[1mm\033[0m (module" << ::std::endl
+ << " interface) letters. If unspecified and no individual extensions are" << ::std::endl
+ << " specified with the below options, then \033[1m?xx\033[0m is used by default." << ::std::endl
+ << ::std::endl
+ << " \033[1mhxx=\033[0m\033[4mextension\033[0m\033[0m" << ::std::endl
+ << " Use the specified \033[4mextension\033[0m for header files instead of the default \033[1m.hxx\033[0m." << ::std::endl
+ << ::std::endl
+ << " \033[1mcxx=\033[0m\033[4mextension\033[0m\033[0m" << ::std::endl
+ << " Use the specified \033[4mextension\033[0m for source files instead of the default \033[1m.cxx\033[0m." << ::std::endl
+ << ::std::endl
+ << " \033[1mixx=\033[0m\033[4mextension\033[0m\033[0m" << ::std::endl
+ << " Use the specified \033[4mextension\033[0m for inline files. If unspecified, then assume" << ::std::endl
+ << " no inline files are used by the project." << ::std::endl
+ << ::std::endl
+ << " \033[1mtxx=\033[0m\033[4mextension\033[0m\033[0m" << ::std::endl
+ << " Use the specified \033[4mextension\033[0m for template files. If unspecified, then assume" << ::std::endl
+ << " no template files are used by the project." << ::std::endl
+ << ::std::endl
+ << " \033[1mmxx=\033[0m\033[4mextension\033[0m\033[0m" << ::std::endl
+ << " Use the specified \033[4mextension\033[0m for module interface files. If unspecified," << ::std::endl
+ << " then assume no modules are used by the project." << ::std::endl
+ << ::std::endl
+ << " \033[1mc\033[0m" << ::std::endl
+ << " A C++ project that can also use C." << ::std::endl
+ << ::std::endl
+ << "As an example, the following command creates a header-only C++ library that" << ::std::endl
+ << "uses the \033[1m.h\033[0m extension for header files and \033[1m.cpp\033[0m -- for source files:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++,hxx=h,cxx=cpp -t lib,binless libhello" << ::std::endl
+ << ::std::endl
+ << "The project type can be specified with the \033[1m--type\033[0m|\033[1m-t\033[0m\033[0m option. The \033[1mempty\033[0m project" << ::std::endl
+ << "type is language-agnostic with the semantics and valid sub-options for the rest" << ::std::endl
+ << "being language-dependent, as described next. If unspecified, an executable" << ::std::endl
+ << "project is created by default." << ::std::endl
+ << ::std::endl
+ << "\033[1mexe\033[0m" << ::std::endl
+ << " A project that builds a sample C or C++ executable. Recognized executable" << ::std::endl
+ << " project sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-tests\033[0m" << ::std::endl
+ << " Don't add support for functional/integration testing." << ::std::endl
+ << ::std::endl
+ << " \033[1munit-tests\033[0m" << ::std::endl
+ << " Add support for unit testing." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-install\033[0m" << ::std::endl
+ << " Don't add support for installing." << ::std::endl
+ << ::std::endl
+ << " \033[1mexport-stub\033[0m" << ::std::endl
+ << " Add support for importing this project's targets from other projects." << ::std::endl
+ << ::std::endl
+ << " \033[1mprefix=\033[0m\033[4mdir\033[0m\033[0m" << ::std::endl
+ << " Optional source prefix relative to project/package root." << ::std::endl
+ << ::std::endl
+ << " \033[1msubdir=\033[0m\033[4mdir\033[0m\033[0m" << ::std::endl
+ << " Alternative source subdirectory relative to source prefix." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-subdir\033[0m" << ::std::endl
+ << " Omit the source subdirectory." << ::std::endl
+ << ::std::endl
+ << " \033[1mbuildfile-in-prefix\033[0m" << ::std::endl
+ << " Create the \033[1mbuildfile\033[0m in the source prefix directory rather than in its" << ::std::endl
+ << " source subdirectory." << ::std::endl
+ << ::std::endl
+ << " \033[1mthird-party\033[0m" << ::std::endl
+ << " Create a package for converting an existing third-party executable to" << ::std::endl
+ << " \033[1mbuild2\033[0m. This sub-option automatically enables the \033[1mno-readme\033[0m sub-option. It" << ::std::endl
+ << " also adds a number of values to \033[1mmanifest\033[0m that makes sense to specify in a" << ::std::endl
+ << " package of a third-party project and, unless \033[1mno-package-readme\033[0m is" << ::std::endl
+ << " specified, generates the \033[1mPACKAGE-README.md\033[0m template (see" << ::std::endl
+ << " \033[1mpackage-description\033[0m (bpkg#manifest-package-description) package manifest" << ::std::endl
+ << " value for background)." << ::std::endl
+ << ::std::endl
+ << " \033[1mlicense=\033[0m\033[4mname\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-readme\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-package-readme\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1malt-naming\033[0m" << ::std::endl
+ << " See \033[1mcommon\033[0m sub-options below." << ::std::endl
+ << ::std::endl
+ << "\033[1mlib\033[0m" << ::std::endl
+ << " A project that builds a sample C or C++ library. Recognized library project" << ::std::endl
+ << " sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mbinless\033[0m" << ::std::endl
+ << " Create a header-only library." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-tests\033[0m" << ::std::endl
+ << " Don't add support for functional/integration testing." << ::std::endl
+ << ::std::endl
+ << " \033[1munit-tests\033[0m" << ::std::endl
+ << " Add support for unit testing." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-install\033[0m" << ::std::endl
+ << " Don't add support for installing." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-version\033[0m" << ::std::endl
+ << " Don't add support for generating the version header." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-symexport\033[0m" << ::std::endl
+ << " Don't add support for DLL symbol exporting." << ::std::endl
+ << ::std::endl
+ << " \033[1mauto-symexport\033[0m" << ::std::endl
+ << " Add support for automatic DLL symbol exporting." << ::std::endl
+ << ::std::endl
+ << " \033[1mprefix-include=\033[0m\033[4mdir\033[0m\033[0m" << ::std::endl
+ << " Optional public header prefix relative to project/package root." << ::std::endl
+ << ::std::endl
+ << " \033[1mprefix-source=\033[0m\033[4mdir\033[0m\033[0m" << ::std::endl
+ << " Optional source prefix relative to project/package root." << ::std::endl
+ << ::std::endl
+ << " \033[1mprefix=\033[0m\033[4mdir\033[0m\033[0m" << ::std::endl
+ << " Shortcut for \033[1mprefix-include=\033[0m\033[4mdir\033[0m\033[1m,prefix-source=\033[0m\033[4mdir\033[0m\033[0m." << ::std::endl
+ << ::std::endl
+ << " \033[1msplit\033[0m" << ::std::endl
+ << " Shortcut for \033[1mprefix-include=include,prefix-source=src\033[0m." << ::std::endl
+ << ::std::endl
+ << " \033[1msubdir=\033[0m\033[4mdir\033[0m\033[0m" << ::std::endl
+ << " Alternative source subdirectory relative to header/source prefix." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-subdir-include\033[0m" << ::std::endl
+ << " Omit the source subdirectory relative to the header prefix." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-subdir-source\033[0m" << ::std::endl
+ << " Omit the source subdirectory relative to the source prefix." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-subdir\033[0m" << ::std::endl
+ << " Shortcut for \033[1mno-subdir-include,no-subdir-source\033[0m." << ::std::endl
+ << ::std::endl
+ << " \033[1mbuildfile-in-prefix\033[0m" << ::std::endl
+ << " Create the \033[1mbuildfiles\033[0m in the header/source prefix directories rather than" << ::std::endl
+ << " in their source subdirectories." << ::std::endl
+ << ::std::endl
+ << " \033[1mthird-party\033[0m" << ::std::endl
+ << " Create a package for converting an existing third-party library to \033[1mbuild2\033[0m." << ::std::endl
+ << " This sub-option automatically enables the \033[1mno-version\033[0m and \033[1mno-readme\033[0m" << ::std::endl
+ << " sub-options as well as \033[1mno-symexport\033[0m unless \033[1mauto-symexport\033[0m is specified. It" << ::std::endl
+ << " also adds a number of values to \033[1mmanifest\033[0m that makes sense to specify in a" << ::std::endl
+ << " package of a third-party project and, unless \033[1mno-package-readme\033[0m is" << ::std::endl
+ << " specified, generates the \033[1mPACKAGE-README.md\033[0m template (see" << ::std::endl
+ << " \033[1mpackage-description\033[0m (bpkg#manifest-package-description) package manifest" << ::std::endl
+ << " value for background)." << ::std::endl
+ << ::std::endl
+ << " \033[1mlicense=\033[0m\033[4mname\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-readme\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-package-readme\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1malt-naming\033[0m" << ::std::endl
+ << " See \033[1mcommon\033[0m sub-options below." << ::std::endl
+ << ::std::endl
+ << "\033[1mbare\033[0m" << ::std::endl
+ << " A project without any source code that can be filled later (see \033[1m--source\033[0m)." << ::std::endl
+ << " Recognized bare project sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-tests\033[0m" << ::std::endl
+ << " Don't add support for testing." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-install\033[0m" << ::std::endl
+ << " Don't add support for installing." << ::std::endl
+ << ::std::endl
+ << " \033[1mlicense=\033[0m\033[4mname\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-readme\033[0m" << ::std::endl
+ << ::std::endl
+ << " \033[1malt-naming\033[0m" << ::std::endl
+ << " See \033[1mcommon\033[0m sub-options below." << ::std::endl
+ << ::std::endl
+ << "\033[1mempty\033[0m" << ::std::endl
+ << " An empty project that can be filled with packages (see \033[1m--package\033[0m)." << ::std::endl
+ << " Recognized empty project sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mthird-party\033[0m" << ::std::endl
+ << " Create a project for converting an existing third-party project to \033[1mbuild2\033[0m." << ::std::endl
+ << " This sub-option adjusts the generated \033[1mREADME.md\033[0m template wording to reflect" << ::std::endl
+ << " such a conversion." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-readme\033[0m" << ::std::endl
+ << " See \033[1mcommon\033[0m sub-options below." << ::std::endl
+ << ::std::endl
+ << "\033[1mcommon\033[0m" << ::std::endl
+ << " Common project type sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mlicense=\033[0m\033[4mname\033[0m\033[0m" << ::std::endl
+ << " Specify the project's license. The license name can be an SPDX License" << ::std::endl
+ << " Expression (https://spdx.org/licenses/), which, in its simplest form, is" << ::std::endl
+ << " just the license ID. Or it can be a free form name in the \033[1mother:\033[0m license" << ::std::endl
+ << " name scheme. If unspecified, then \033[1mother: proprietary\033[0m is assumed. The" << ::std::endl
+ << " following tables lists the most commonly used free/open source software" << ::std::endl
+ << " license IDs as well as a number of pre-defined \033[1mother:\033[0m names. See the" << ::std::endl
+ << " \033[1mlicense\033[0m (bpkg#manifest-package-license) package manifest value for more" << ::std::endl
+ << " information." << ::std::endl
+ << ::std::endl
+ << " MIT MIT License." << ::std::endl
+ << ::std::endl
+ << " BSD-2-Clause BSD 2-Clause \"Simplified\" License" << ::std::endl
+ << " BSD-3-Clause BSD 3-Clause \"New\" or \"Revised\" License" << ::std::endl
+ << ::std::endl
+ << " GPL-3.0-only GNU General Public License v3.0 only" << ::std::endl
+ << " GPL-3.0-or-later GNU General Public License v3.0 or later" << ::std::endl
+ << ::std::endl
+ << " LGPL-3.0-only GNU Lesser General Public License v3.0 only" << ::std::endl
+ << " LGPL-3.0-or-later GNU Lesser General Public License v3.0 or later" << ::std::endl
+ << ::std::endl
+ << " AGPL-3.0-only GNU Affero General Public License v3.0 only" << ::std::endl
+ << " AGPL-3.0-or-later GNU Affero General Public License v3.0 or later" << ::std::endl
+ << ::std::endl
+ << " Apache-2.0 Apache License 2.0" << ::std::endl
+ << ::std::endl
+ << " MPL-2.0 Mozilla Public License 2.0" << ::std::endl
+ << ::std::endl
+ << " BSL-1.0 Boost Software License 1.0" << ::std::endl
+ << ::std::endl
+ << " Unlicense The Unlicense (public domain)" << ::std::endl
+ << ::std::endl
+ << " other: public domain Released into the public domain" << ::std::endl
+ << " other: available source Not free/open source with public source code" << ::std::endl
+ << " other: proprietary Not free/open source" << ::std::endl
+ << " other: TODO License is not yet decided" << ::std::endl
+ << ::std::endl
+ << " \033[1mno-readme\033[0m" << ::std::endl
+ << " Don't add new \033[1mREADME.md\033[0m (but still check for the existing one)." << ::std::endl
+ << ::std::endl
+ << " \033[1mno-package-readme\033[0m" << ::std::endl
+ << " Don't add new \033[1mPACKAGE-README.md\033[0m (but still check for the existing one)." << ::std::endl
+ << ::std::endl
+ << " \033[1malt-naming\033[0m" << ::std::endl
+ << " Use the alternative build file/directory naming scheme." << ::std::endl
+ << ::std::endl
+ << "The project version control system can be specified with the \033[1m--vcs\033[0m|\033[1m-s\033[0m\033[0m option." << ::std::endl
+ << "Valid values for this option and their semantics are described next. If" << ::std::endl
+ << "unspecified, \033[1mgit\033[0m is assumed by default." << ::std::endl
+ << ::std::endl
+ << "\033[1mgit\033[0m" << ::std::endl
+ << " Initialize a \033[1mgit(1)\033[0m repository inside the project and generate \033[1m.gitignore\033[0m" << ::std::endl
+ << " files. Recognized version control system sub-options:" << ::std::endl
+ << ::std::endl
+ << " \033[1mbranch=\033[0m\033[4mname\033[0m\033[0m" << ::std::endl
+ << " Use the specified name for the initial branch in the newly created" << ::std::endl
+ << " repository." << ::std::endl
+ << ::std::endl
+ << "\033[1mnone\033[0m" << ::std::endl
+ << " Don't initialize a version control system inside the project." << ::std::endl
+ << ::std::endl
+ << "The created project, package, or source subdirectory can be further customized" << ::std::endl
+ << "using the pre and post-creation hooks specified with the \033[1m--pre-hook\033[0m and" << ::std::endl
+ << "\033[1m--post-hook\033[0m options, respectively. The pre hooks are executed before any new" << ::std::endl
+ << "files are created and the post hook -- after all the files have been created." << ::std::endl
+ << "The hook commands are executed in the project, package, or source directory as" << ::std::endl
+ << "their current working directory. For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new --post-hook \"echo .idea/ >>.gitignore\" hello" << ::std::endl
+ << ::std::endl
+ << "The pre hooks are primarily useful for moving/renaming existing files that" << ::std::endl
+ << "would otherwise clash with files created by the \033[1mnew\033[0m command. For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep new --pre-hook \"mv .gitignore .gitignore.bak\" \\" << ::std::endl
+ << " --post-hook \"cat .gitignore.bak >>.gitignore\" \\" << ::std::endl
+ << " --post-hook \"rm .gitignore.bak\" ..." << ::std::endl
+ << ::std::endl
+ << "See the \033[1m--pre-hook\033[0m and \033[1m--post-hook\033[0m options documentation below for details." << ::std::endl;
+
+ p = ::bdep::cmd_new_c_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ p = ::bdep::cmd_new_cxx_options::print_usage (os, p);
+
+ p = ::bdep::cmd_new_exe_options::print_usage (os, p);
+
+ p = ::bdep::cmd_new_lib_options::print_usage (os, p);
+
+ p = ::bdep::cmd_new_bare_options::print_usage (os, p);
+
+ p = ::bdep::cmd_new_empty_options::print_usage (os, p);
+
+ p = ::bdep::cmd_new_git_options::print_usage (os, p);
+
+ p = ::bdep::cmd_new_none_options::print_usage (os, p);
+
+ p = ::bdep::cmd_new_options::print_usage (os, p);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSOURCE LAYOUT\033[0m" << ::std::endl
+ << ::std::endl
+ << "C and C++ projects employ a bewildering variety of source code layouts most of" << ::std::endl
+ << "which fit into two broad classes: \033[4mcombined\033[0m, where all the source code for a" << ::std::endl
+ << "single executable or library resides in the same directory and \033[4msplit\033[0m, where" << ::std::endl
+ << "headers (typically public headers of a library) and other source files reside" << ::std::endl
+ << "in separate directories (most commonly called \033[1minclude/\033[0m and \033[1msrc/\033[0m)." << ::std::endl
+ << ::std::endl
+ << "To support the creation of such varying layouts the \033[1mnew\033[0m command divides paths" << ::std::endl
+ << "leading to source code inside a package/project into a number of customizable" << ::std::endl
+ << "components:" << ::std::endl
+ << ::std::endl
+ << "libhello/{include,src}/hello/" << ::std::endl
+ << " ^ ^ ^" << ::std::endl
+ << " | | |" << ::std::endl
+ << " project/ source source" << ::std::endl
+ << " package prefix subdirectory" << ::std::endl
+ << " root" << ::std::endl
+ << ::std::endl
+ << "Note that while the same physical layout can be achieved with various" << ::std::endl
+ << "combinations of source prefix and subdirectory, there will be differences in" << ::std::endl
+ << "semantics since the headers in the project are included with the source" << ::std::endl
+ << "subdirectory (if any) as a prefix. See Canonical Project Structure" << ::std::endl
+ << "(intro#proj-struct) for rationale and details." << ::std::endl
+ << ::std::endl
+ << "As we have already seen, the source subdirectory can be customized with the" << ::std::endl
+ << "\033[1msubdir\033[0m project type sub-option. For example:" << ::std::endl
+ << ::std::endl
+ << "# libhello/hello/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,subdir=hello libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "`-- hello/" << ::std::endl
+ << " |-- hello.hxx" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "Note: pass \033[1m-l c++,cpp\033[0m if you prefer the \033[1m.hpp\033[0m/\033[1m.cpp\033[0m source file naming scheme." << ::std::endl
+ << ::std::endl
+ << "The source prefix can be combined, in which case it can be customized with the" << ::std::endl
+ << "single \033[1mprefix\033[0m project type sub-option. For example:" << ::std::endl
+ << ::std::endl
+ << "# hello/src/hello/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t exe,prefix=src hello" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- hello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "The prefix can also be split, in which case the \033[1mprefix-include\033[0m and" << ::std::endl
+ << "\033[1mprefix-source\033[0m sub-options can be used to customize the respective directories" << ::std::endl
+ << "independently. If either is omitted, then the corresponding prefix is left" << ::std::endl
+ << "empty. For example:" << ::std::endl
+ << ::std::endl
+ << "# libhello/{include,.}/libhello/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,prefix-include=include libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- include/" << ::std::endl
+ << "| `-- libhello/" << ::std::endl
+ << "| `-- hello.hxx" << ::std::endl
+ << "`-- libhello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "The \033[1msplit\033[0m sub-option is a convenient shortcut for the most common case where" << ::std::endl
+ << "the header prefix is \033[1minclude/\033[0m and source prefix is \033[1msrc/\033[0m. For example:" << ::std::endl
+ << ::std::endl
+ << "# libhello/{include,src}/libhello/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,split libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- include/" << ::std::endl
+ << "| `-- libhello/" << ::std::endl
+ << "| `-- hello.hxx" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- libhello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "The source subdirectory can be omitted by specifying the \033[1mno-subdir\033[0m project type" << ::std::endl
+ << "sub-option. For example:" << ::std::endl
+ << ::std::endl
+ << "# hello/src/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t exe,prefix=src,no-subdir hello" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "The same but for the split layout (we also have to disable the generated" << ::std::endl
+ << "version header that is not supported in this layout):" << ::std::endl
+ << ::std::endl
+ << "# libhello/{include,src}/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,split,no-subdir,no-version libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- include/" << ::std::endl
+ << "| `-- hello.hxx" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "To achieve the layout where all the source code resides in the project root, we" << ::std::endl
+ << "omit both the source prefix and subdirectory (we also have to disable a couple" << ::std::endl
+ << "of other features that are not supported in this layout):" << ::std::endl
+ << ::std::endl
+ << "# hello/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,no-subdir,no-version,no-tests libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- hello.cxx" << ::std::endl
+ << "`-- hello.hxx" << ::std::endl
+ << ::std::endl
+ << "We can also omit the source subdirectory but only in the source prefix of the" << ::std::endl
+ << "split layout by specifying the \033[1mno-subdir-source\033[0m sub-option. For example:" << ::std::endl
+ << ::std::endl
+ << "# libhello/{include/hello,src}/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t lib,split,subdir=hello,no-subdir-source libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- include/" << ::std::endl
+ << "| `-- hello/" << ::std::endl
+ << "| `-- hello.hxx" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "Similarly, we can also omit the source subdirectory but only in the header" << ::std::endl
+ << "prefix of the split layout by specifying the \033[1mno-subdir-include\033[0m sub-option (we" << ::std::endl
+ << "also have to disable the generated version header that is not supported in this" << ::std::endl
+ << "layout):" << ::std::endl
+ << ::std::endl
+ << "# libhello/{include,src/hello}/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new \\" << ::std::endl
+ << " -l c++ \\" << ::std::endl
+ << " -t lib,split,subdir=hello,no-subdir-include,no-version \\" << ::std::endl
+ << " libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- include/" << ::std::endl
+ << "| `-- hello.hxx" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- hello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "To achieve the split layout where the \033[1minclude/\033[0m directory is inside \033[1msrc/\033[0m:" << ::std::endl
+ << ::std::endl
+ << "# libhello/src/{include,.}/hello/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new \\" << ::std::endl
+ << " -l c++ \\" << ::std::endl
+ << " -t lib,prefix-include=src/include,prefix-source=src,subdir=hello \\" << ::std::endl
+ << " libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " |-- include/" << ::std::endl
+ << " | `-- hello/" << ::std::endl
+ << " | `-- hello.hxx" << ::std::endl
+ << " `-- hello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "A similar layout but without the source subdirectory in \033[1msrc/\033[0m:" << ::std::endl
+ << ::std::endl
+ << "# libhello/src/{include/hello,.}/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new \\" << ::std::endl
+ << " -l c++ \\" << ::std::endl
+ << " -t lib,prefix-include=src/include,prefix-source=src,\\" << ::std::endl
+ << "subdir=hello,no-subdir-source \\" << ::std::endl
+ << " libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " |-- include/" << ::std::endl
+ << " | `-- hello/" << ::std::endl
+ << " | `-- hello.hxx" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "The layout used by the Boost libraries:" << ::std::endl
+ << ::std::endl
+ << "# libhello/{include/hello,libs/hello/src}/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new \\" << ::std::endl
+ << " -l c++ \\" << ::std::endl
+ << " -t lib,prefix-include=include,prefix-source=libs/hello/src,\\" << ::std::endl
+ << "subdir=hello,no-subdir-source \\" << ::std::endl
+ << " libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree libhello/" << ::std::endl
+ << "libhello/" << ::std::endl
+ << "|-- include/" << ::std::endl
+ << "| `-- hello/" << ::std::endl
+ << "| `-- hello.hxx" << ::std::endl
+ << "`-- libs/" << ::std::endl
+ << " `-- hello/" << ::std::endl
+ << " `-- src/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "A layout where multiple components each have their own \033[1minclude/src\033[0m split:" << ::std::endl
+ << ::std::endl
+ << "# hello/libhello1/{include/hello1,src}/" << ::std::endl
+ << "# hello/libhello2/{include/hello2,src}/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t bare hello" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -d hello --source \\" << ::std::endl
+ << " -l c++ \\" << ::std::endl
+ << " -t lib,\\" << ::std::endl
+ << "prefix-include=libhello1/include,prefix-source=libhello1/src,\\" << ::std::endl
+ << "subdir=hello1,no-subdir-source \\" << ::std::endl
+ << " libhello1" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -d hello --source \\" << ::std::endl
+ << " -l c++ \\" << ::std::endl
+ << " -t lib,\\" << ::std::endl
+ << "prefix-include=libhello2/include,prefix-source=libhello2/src,\\" << ::std::endl
+ << "subdir=hello2,no-subdir-source \\" << ::std::endl
+ << " libhello2" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "|-- libhello1/" << ::std::endl
+ << "| |-- include/" << ::std::endl
+ << "| | `-- hello1/" << ::std::endl
+ << "| | `-- hello1.hxx" << ::std::endl
+ << "| `-- src/" << ::std::endl
+ << "| `-- hello1.cxx" << ::std::endl
+ << "`-- libhello2/" << ::std::endl
+ << " |-- include/" << ::std::endl
+ << " | `-- hello2/" << ::std::endl
+ << " | `-- hello2.hxx" << ::std::endl
+ << " `-- src/" << ::std::endl
+ << " `-- hello2.cxx" << ::std::endl
+ << ::std::endl
+ << "A layout where libraries and executables have different prefixes:" << ::std::endl
+ << ::std::endl
+ << "# hello/libs/libhello/{include/hello,src}/" << ::std::endl
+ << "# hello/src/hello/" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c++ -t bare hello" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -d hello --source \\" << ::std::endl
+ << " -l c++ \\" << ::std::endl
+ << " -t lib,\\" << ::std::endl
+ << "prefix-include=libs/libhello/include,prefix-source=libs/libhello/src,\\" << ::std::endl
+ << "subdir=hello,no-subdir-source \\" << ::std::endl
+ << " libhello" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -d hello --source -l c++ -t exe,prefix=src hello" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "|-- libs/" << ::std::endl
+ << "| `-- libhello/" << ::std::endl
+ << "| |-- include/" << ::std::endl
+ << "| | `-- hello/" << ::std::endl
+ << "| | `-- hello.hxx" << ::std::endl
+ << "| `-- src/" << ::std::endl
+ << "| `-- hello.cxx" << ::std::endl
+ << "`-- src/" << ::std::endl
+ << " `-- hello/" << ::std::endl
+ << " `-- hello.cxx" << ::std::endl
+ << ::std::endl
+ << "When packaging a third-party project for \033[1mbuild2\033[0m, one of the common approaches" << ::std::endl
+ << "is to create a project with the split layout and the \033[1mbuildfiles\033[0m in the source" << ::std::endl
+ << "prefix directories rather than in the source subdirectories:" << ::std::endl
+ << ::std::endl
+ << "# hello/libhello/{include,src}/hello/" << ::std::endl
+ << "# hello/libhello/{include,src}/buildfile" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -l c -t empty hello" << ::std::endl
+ << ::std::endl
+ << "$ bdep new -d hello --package \\" << ::std::endl
+ << " -l c \\" << ::std::endl
+ << " -t lib, \\" << ::std::endl
+ << "split,subdir=hello,no-version,no-symexport,buildfile-in-prefix \\" << ::std::endl
+ << " libhello" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "`-- libhello/" << ::std::endl
+ << " |-- include/" << ::std::endl
+ << " | |-- buildfile" << ::std::endl
+ << " | `-- hello/" << ::std::endl
+ << " | `-- hello.h" << ::std::endl
+ << " `-- src/" << ::std::endl
+ << " |-- buildfile" << ::std::endl
+ << " `-- hello/" << ::std::endl
+ << " `-- hello.c" << ::std::endl
+ << ::std::endl
+ << "After that the upstream project is added as a \033[1mgit\033[0m submodule to the project root" << ::std::endl
+ << "directory and the source subdirectories are replaced with the symbolic links to" << ::std::endl
+ << "the directories inside the upstream project directory:" << ::std::endl
+ << ::std::endl
+ << "$ tree hello/" << ::std::endl
+ << "hello/" << ::std::endl
+ << "|-- libhello/" << ::std::endl
+ << "| |-- include/" << ::std::endl
+ << "| | |-- buildfile" << ::std::endl
+ << "| | `-- hello/ -> ../../upstream/include/hello/" << ::std::endl
+ << "| `-- src/" << ::std::endl
+ << "| |-- buildfile" << ::std::endl
+ << "| `-- hello/ -> ../../upstream/src/" << ::std::endl
+ << "`-- upstream/" << ::std::endl
+ << " |-- include/" << ::std::endl
+ << " | `-- hello/" << ::std::endl
+ << " | `-- hello.h" << ::std::endl
+ << " `-- src/" << ::std::endl
+ << " `-- hello.c" << ::std::endl
+ << ::std::endl
+ << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mnew\033[0m command the search start directory is the project directory in the" << ::std::endl
+ << "package and source modes and the parent directory of the new project in all" << ::std::endl
+ << "other modes. The following options files are searched for in each directory" << ::std::endl
+ << "and, if found, loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-{config config-add}.options # if --config-add|-A" << ::std::endl
+ << "bdep-{config config-add config-create}.options # if --config-create|-C" << ::std::endl
+ << "bdep-new.options" << ::std::endl
+ << "bdep-new-{project|package|source}.options # (mode-dependent)" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mnew\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--output-dir|-o" << ::std::endl
+ << "--directory|-d" << ::std::endl
+ << "--package" << ::std::endl
+ << "--source" << ::std::endl
+ << "--no-checks" << ::std::endl
+ << "--config-add|-A" << ::std::endl
+ << "--config-create|-C" << ::std::endl
+ << "--wipe" << ::std::endl
+ << ::std::endl
+ << "While the presence of the \033[1m--pre-hook\033[0m or \033[1m--post-hook\033[0m options in remote default" << ::std::endl
+ << "options files will trigger a prompt." << ::std::endl
+ << ::std::endl
+ << "\033[1mENVIRONMENT\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mBDEP_AUTHOR_EMAIL\033[0m environment variable can be used to specify the package" << ::std::endl
+ << "email address. If not set, the \033[1mnew\033[0m command will first try to obtain the email" << ::std::endl
+ << "from the version control system (if used) and then from the \033[1mEMAIL\033[0m environment" << ::std::endl
+ << "variable. If all these methods fail, a dummy \033[1myou@example.org\033[0m email is used." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/new-options.hxx b/bdep/new-options.hxx
new file mode 100644
index 0000000..1ea9c18
--- /dev/null
+++ b/bdep/new-options.hxx
@@ -0,0 +1,1696 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_NEW_OPTIONS_HXX
+#define BDEP_NEW_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+#include <bdep/new-types.hxx>
+
+namespace bdep
+{
+ class cmd_new_c_options
+ {
+ public:
+ cmd_new_c_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_c_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ cpp () const;
+
+ bool&
+ cpp ();
+
+ void
+ cpp (const bool&);
+
+ const string&
+ hxx () const;
+
+ string&
+ hxx ();
+
+ void
+ hxx (const string&);
+
+ bool
+ hxx_specified () const;
+
+ void
+ hxx_specified (bool);
+
+ const string&
+ cxx () const;
+
+ string&
+ cxx ();
+
+ void
+ cxx (const string&);
+
+ bool
+ cxx_specified () const;
+
+ void
+ cxx_specified (bool);
+
+ const string&
+ ixx () const;
+
+ string&
+ ixx ();
+
+ void
+ ixx (const string&);
+
+ bool
+ ixx_specified () const;
+
+ void
+ ixx_specified (bool);
+
+ const string&
+ txx () const;
+
+ string&
+ txx ();
+
+ void
+ txx (const string&);
+
+ bool
+ txx_specified () const;
+
+ void
+ txx_specified (bool);
+
+ const string&
+ mxx () const;
+
+ string&
+ mxx ();
+
+ void
+ mxx (const string&);
+
+ bool
+ mxx_specified () const;
+
+ void
+ mxx_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_c_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool cpp_;
+ string hxx_;
+ bool hxx_specified_;
+ string cxx_;
+ bool cxx_specified_;
+ string ixx_;
+ bool ixx_specified_;
+ string txx_;
+ bool txx_specified_;
+ string mxx_;
+ bool mxx_specified_;
+ };
+
+ class cmd_new_cxx_options
+ {
+ public:
+ cmd_new_cxx_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_cxx_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ cpp () const;
+
+ bool&
+ cpp ();
+
+ void
+ cpp (const bool&);
+
+ const string&
+ extension () const;
+
+ string&
+ extension ();
+
+ void
+ extension (const string&);
+
+ bool
+ extension_specified () const;
+
+ void
+ extension_specified (bool);
+
+ const string&
+ hxx () const;
+
+ string&
+ hxx ();
+
+ void
+ hxx (const string&);
+
+ bool
+ hxx_specified () const;
+
+ void
+ hxx_specified (bool);
+
+ const string&
+ cxx () const;
+
+ string&
+ cxx ();
+
+ void
+ cxx (const string&);
+
+ bool
+ cxx_specified () const;
+
+ void
+ cxx_specified (bool);
+
+ const string&
+ ixx () const;
+
+ string&
+ ixx ();
+
+ void
+ ixx (const string&);
+
+ bool
+ ixx_specified () const;
+
+ void
+ ixx_specified (bool);
+
+ const string&
+ txx () const;
+
+ string&
+ txx ();
+
+ void
+ txx (const string&);
+
+ bool
+ txx_specified () const;
+
+ void
+ txx_specified (bool);
+
+ const string&
+ mxx () const;
+
+ string&
+ mxx ();
+
+ void
+ mxx (const string&);
+
+ bool
+ mxx_specified () const;
+
+ void
+ mxx_specified (bool);
+
+ const bool&
+ c () const;
+
+ bool&
+ c ();
+
+ void
+ c (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_cxx_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool cpp_;
+ string extension_;
+ bool extension_specified_;
+ string hxx_;
+ bool hxx_specified_;
+ string cxx_;
+ bool cxx_specified_;
+ string ixx_;
+ bool ixx_specified_;
+ string txx_;
+ bool txx_specified_;
+ string mxx_;
+ bool mxx_specified_;
+ bool c_;
+ };
+
+ class cmd_new_exe_options
+ {
+ public:
+ cmd_new_exe_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_exe_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ no_tests () const;
+
+ bool&
+ no_tests ();
+
+ void
+ no_tests (const bool&);
+
+ const bool&
+ unit_tests () const;
+
+ bool&
+ unit_tests ();
+
+ void
+ unit_tests (const bool&);
+
+ const bool&
+ no_install () const;
+
+ bool&
+ no_install ();
+
+ void
+ no_install (const bool&);
+
+ const bool&
+ export_stub () const;
+
+ bool&
+ export_stub ();
+
+ void
+ export_stub (const bool&);
+
+ const dir_path&
+ prefix () const;
+
+ dir_path&
+ prefix ();
+
+ void
+ prefix (const dir_path&);
+
+ bool
+ prefix_specified () const;
+
+ void
+ prefix_specified (bool);
+
+ const dir_path&
+ subdir () const;
+
+ dir_path&
+ subdir ();
+
+ void
+ subdir (const dir_path&);
+
+ bool
+ subdir_specified () const;
+
+ void
+ subdir_specified (bool);
+
+ const bool&
+ no_subdir () const;
+
+ bool&
+ no_subdir ();
+
+ void
+ no_subdir (const bool&);
+
+ const bool&
+ buildfile_in_prefix () const;
+
+ bool&
+ buildfile_in_prefix ();
+
+ void
+ buildfile_in_prefix (const bool&);
+
+ const bool&
+ third_party () const;
+
+ bool&
+ third_party ();
+
+ void
+ third_party (const bool&);
+
+ const string&
+ license () const;
+
+ string&
+ license ();
+
+ void
+ license (const string&);
+
+ bool
+ license_specified () const;
+
+ void
+ license_specified (bool);
+
+ const bool&
+ no_readme () const;
+
+ bool&
+ no_readme ();
+
+ void
+ no_readme (const bool&);
+
+ const bool&
+ no_package_readme () const;
+
+ bool&
+ no_package_readme ();
+
+ void
+ no_package_readme (const bool&);
+
+ const bool&
+ alt_naming () const;
+
+ bool&
+ alt_naming ();
+
+ void
+ alt_naming (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_exe_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool no_tests_;
+ bool unit_tests_;
+ bool no_install_;
+ bool export_stub_;
+ dir_path prefix_;
+ bool prefix_specified_;
+ dir_path subdir_;
+ bool subdir_specified_;
+ bool no_subdir_;
+ bool buildfile_in_prefix_;
+ bool third_party_;
+ string license_;
+ bool license_specified_;
+ bool no_readme_;
+ bool no_package_readme_;
+ bool alt_naming_;
+ };
+
+ class cmd_new_lib_options
+ {
+ public:
+ cmd_new_lib_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_lib_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ binless () const;
+
+ bool&
+ binless ();
+
+ void
+ binless (const bool&);
+
+ const bool&
+ no_tests () const;
+
+ bool&
+ no_tests ();
+
+ void
+ no_tests (const bool&);
+
+ const bool&
+ unit_tests () const;
+
+ bool&
+ unit_tests ();
+
+ void
+ unit_tests (const bool&);
+
+ const bool&
+ no_install () const;
+
+ bool&
+ no_install ();
+
+ void
+ no_install (const bool&);
+
+ const bool&
+ no_version () const;
+
+ bool&
+ no_version ();
+
+ void
+ no_version (const bool&);
+
+ const bool&
+ no_symexport () const;
+
+ bool&
+ no_symexport ();
+
+ void
+ no_symexport (const bool&);
+
+ const bool&
+ auto_symexport () const;
+
+ bool&
+ auto_symexport ();
+
+ void
+ auto_symexport (const bool&);
+
+ const dir_path&
+ prefix_include () const;
+
+ dir_path&
+ prefix_include ();
+
+ void
+ prefix_include (const dir_path&);
+
+ bool
+ prefix_include_specified () const;
+
+ void
+ prefix_include_specified (bool);
+
+ const dir_path&
+ prefix_source () const;
+
+ dir_path&
+ prefix_source ();
+
+ void
+ prefix_source (const dir_path&);
+
+ bool
+ prefix_source_specified () const;
+
+ void
+ prefix_source_specified (bool);
+
+ const dir_path&
+ prefix () const;
+
+ dir_path&
+ prefix ();
+
+ void
+ prefix (const dir_path&);
+
+ bool
+ prefix_specified () const;
+
+ void
+ prefix_specified (bool);
+
+ const bool&
+ split () const;
+
+ bool&
+ split ();
+
+ void
+ split (const bool&);
+
+ const dir_path&
+ subdir () const;
+
+ dir_path&
+ subdir ();
+
+ void
+ subdir (const dir_path&);
+
+ bool
+ subdir_specified () const;
+
+ void
+ subdir_specified (bool);
+
+ const bool&
+ no_subdir_include () const;
+
+ bool&
+ no_subdir_include ();
+
+ void
+ no_subdir_include (const bool&);
+
+ const bool&
+ no_subdir_source () const;
+
+ bool&
+ no_subdir_source ();
+
+ void
+ no_subdir_source (const bool&);
+
+ const bool&
+ no_subdir () const;
+
+ bool&
+ no_subdir ();
+
+ void
+ no_subdir (const bool&);
+
+ const bool&
+ buildfile_in_prefix () const;
+
+ bool&
+ buildfile_in_prefix ();
+
+ void
+ buildfile_in_prefix (const bool&);
+
+ const bool&
+ third_party () const;
+
+ bool&
+ third_party ();
+
+ void
+ third_party (const bool&);
+
+ const string&
+ license () const;
+
+ string&
+ license ();
+
+ void
+ license (const string&);
+
+ bool
+ license_specified () const;
+
+ void
+ license_specified (bool);
+
+ const bool&
+ no_readme () const;
+
+ bool&
+ no_readme ();
+
+ void
+ no_readme (const bool&);
+
+ const bool&
+ no_package_readme () const;
+
+ bool&
+ no_package_readme ();
+
+ void
+ no_package_readme (const bool&);
+
+ const bool&
+ alt_naming () const;
+
+ bool&
+ alt_naming ();
+
+ void
+ alt_naming (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_lib_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool binless_;
+ bool no_tests_;
+ bool unit_tests_;
+ bool no_install_;
+ bool no_version_;
+ bool no_symexport_;
+ bool auto_symexport_;
+ dir_path prefix_include_;
+ bool prefix_include_specified_;
+ dir_path prefix_source_;
+ bool prefix_source_specified_;
+ dir_path prefix_;
+ bool prefix_specified_;
+ bool split_;
+ dir_path subdir_;
+ bool subdir_specified_;
+ bool no_subdir_include_;
+ bool no_subdir_source_;
+ bool no_subdir_;
+ bool buildfile_in_prefix_;
+ bool third_party_;
+ string license_;
+ bool license_specified_;
+ bool no_readme_;
+ bool no_package_readme_;
+ bool alt_naming_;
+ };
+
+ class cmd_new_bare_options
+ {
+ public:
+ cmd_new_bare_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_bare_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ no_tests () const;
+
+ bool&
+ no_tests ();
+
+ void
+ no_tests (const bool&);
+
+ const bool&
+ no_install () const;
+
+ bool&
+ no_install ();
+
+ void
+ no_install (const bool&);
+
+ const string&
+ license () const;
+
+ string&
+ license ();
+
+ void
+ license (const string&);
+
+ bool
+ license_specified () const;
+
+ void
+ license_specified (bool);
+
+ const bool&
+ no_readme () const;
+
+ bool&
+ no_readme ();
+
+ void
+ no_readme (const bool&);
+
+ const bool&
+ alt_naming () const;
+
+ bool&
+ alt_naming ();
+
+ void
+ alt_naming (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_bare_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool no_tests_;
+ bool no_install_;
+ string license_;
+ bool license_specified_;
+ bool no_readme_;
+ bool alt_naming_;
+ };
+
+ class cmd_new_empty_options
+ {
+ public:
+ cmd_new_empty_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_empty_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ third_party () const;
+
+ bool&
+ third_party ();
+
+ void
+ third_party (const bool&);
+
+ const bool&
+ no_readme () const;
+
+ bool&
+ no_readme ();
+
+ void
+ no_readme (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_empty_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool third_party_;
+ bool no_readme_;
+ };
+
+ class cmd_new_git_options
+ {
+ public:
+ cmd_new_git_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_git_options&);
+
+ // Option accessors and modifiers.
+ //
+ const string&
+ branch () const;
+
+ string&
+ branch ();
+
+ void
+ branch (const string&);
+
+ bool
+ branch_specified () const;
+
+ void
+ branch_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_git_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ string branch_;
+ bool branch_specified_;
+ };
+
+ class cmd_new_none_options
+ {
+ public:
+ cmd_new_none_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_none_options&);
+
+ // Option accessors and modifiers.
+ //
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_none_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ };
+
+ class cmd_new_options: public ::bdep::configuration_add_options,
+ public ::bdep::configuration_name_options
+ {
+ public:
+ cmd_new_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_new_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ no_init () const;
+
+ bool&
+ no_init ();
+
+ void
+ no_init (const bool&);
+
+ const bool&
+ package () const;
+
+ bool&
+ package ();
+
+ void
+ package (const bool&);
+
+ const bool&
+ source () const;
+
+ bool&
+ source ();
+
+ void
+ source (const bool&);
+
+ const dir_path&
+ output_dir () const;
+
+ dir_path&
+ output_dir ();
+
+ void
+ output_dir (const dir_path&);
+
+ bool
+ output_dir_specified () const;
+
+ void
+ output_dir_specified (bool);
+
+ const dir_path&
+ directory () const;
+
+ dir_path&
+ directory ();
+
+ void
+ directory (const dir_path&);
+
+ bool
+ directory_specified () const;
+
+ void
+ directory_specified (bool);
+
+ const cmd_new_type&
+ type () const;
+
+ cmd_new_type&
+ type ();
+
+ void
+ type (const cmd_new_type&);
+
+ bool
+ type_specified () const;
+
+ void
+ type_specified (bool);
+
+ const cmd_new_lang&
+ lang () const;
+
+ cmd_new_lang&
+ lang ();
+
+ void
+ lang (const cmd_new_lang&);
+
+ bool
+ lang_specified () const;
+
+ void
+ lang_specified (bool);
+
+ const cmd_new_vcs&
+ vcs () const;
+
+ cmd_new_vcs&
+ vcs ();
+
+ void
+ vcs (const cmd_new_vcs&);
+
+ bool
+ vcs_specified () const;
+
+ void
+ vcs_specified (bool);
+
+ const strings&
+ pre_hook () const;
+
+ strings&
+ pre_hook ();
+
+ void
+ pre_hook (const strings&);
+
+ bool
+ pre_hook_specified () const;
+
+ void
+ pre_hook_specified (bool);
+
+ const strings&
+ post_hook () const;
+
+ strings&
+ post_hook ();
+
+ void
+ post_hook (const strings&);
+
+ bool
+ post_hook_specified () const;
+
+ void
+ post_hook_specified (bool);
+
+ const bool&
+ no_amalgamation () const;
+
+ bool&
+ no_amalgamation ();
+
+ void
+ no_amalgamation (const bool&);
+
+ const bool&
+ no_checks () const;
+
+ bool&
+ no_checks ();
+
+ void
+ no_checks (const bool&);
+
+ const dir_path&
+ config_add () const;
+
+ dir_path&
+ config_add ();
+
+ void
+ config_add (const dir_path&);
+
+ bool
+ config_add_specified () const;
+
+ void
+ config_add_specified (bool);
+
+ const dir_path&
+ config_create () const;
+
+ dir_path&
+ config_create ();
+
+ void
+ config_create (const dir_path&);
+
+ bool
+ config_create_specified () const;
+
+ void
+ config_create_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_new_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool no_init_;
+ bool package_;
+ bool source_;
+ dir_path output_dir_;
+ bool output_dir_specified_;
+ dir_path directory_;
+ bool directory_specified_;
+ cmd_new_type type_;
+ bool type_specified_;
+ cmd_new_lang lang_;
+ bool lang_specified_;
+ cmd_new_vcs vcs_;
+ bool vcs_specified_;
+ strings pre_hook_;
+ bool pre_hook_specified_;
+ strings post_hook_;
+ bool post_hook_specified_;
+ bool no_amalgamation_;
+ bool no_checks_;
+ dir_path config_add_;
+ bool config_add_specified_;
+ dir_path config_create_;
+ bool config_create_specified_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_new_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/new-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_NEW_OPTIONS_HXX
diff --git a/bdep/new-options.ixx b/bdep/new-options.ixx
new file mode 100644
index 0000000..f102746
--- /dev/null
+++ b/bdep/new-options.ixx
@@ -0,0 +1,1665 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_new_c_options
+ //
+
+ inline const bool& cmd_new_c_options::
+ cpp () const
+ {
+ return this->cpp_;
+ }
+
+ inline bool& cmd_new_c_options::
+ cpp ()
+ {
+ return this->cpp_;
+ }
+
+ inline void cmd_new_c_options::
+ cpp (const bool& x)
+ {
+ this->cpp_ = x;
+ }
+
+ inline const string& cmd_new_c_options::
+ hxx () const
+ {
+ return this->hxx_;
+ }
+
+ inline string& cmd_new_c_options::
+ hxx ()
+ {
+ return this->hxx_;
+ }
+
+ inline void cmd_new_c_options::
+ hxx (const string& x)
+ {
+ this->hxx_ = x;
+ }
+
+ inline bool cmd_new_c_options::
+ hxx_specified () const
+ {
+ return this->hxx_specified_;
+ }
+
+ inline void cmd_new_c_options::
+ hxx_specified (bool x)
+ {
+ this->hxx_specified_ = x;
+ }
+
+ inline const string& cmd_new_c_options::
+ cxx () const
+ {
+ return this->cxx_;
+ }
+
+ inline string& cmd_new_c_options::
+ cxx ()
+ {
+ return this->cxx_;
+ }
+
+ inline void cmd_new_c_options::
+ cxx (const string& x)
+ {
+ this->cxx_ = x;
+ }
+
+ inline bool cmd_new_c_options::
+ cxx_specified () const
+ {
+ return this->cxx_specified_;
+ }
+
+ inline void cmd_new_c_options::
+ cxx_specified (bool x)
+ {
+ this->cxx_specified_ = x;
+ }
+
+ inline const string& cmd_new_c_options::
+ ixx () const
+ {
+ return this->ixx_;
+ }
+
+ inline string& cmd_new_c_options::
+ ixx ()
+ {
+ return this->ixx_;
+ }
+
+ inline void cmd_new_c_options::
+ ixx (const string& x)
+ {
+ this->ixx_ = x;
+ }
+
+ inline bool cmd_new_c_options::
+ ixx_specified () const
+ {
+ return this->ixx_specified_;
+ }
+
+ inline void cmd_new_c_options::
+ ixx_specified (bool x)
+ {
+ this->ixx_specified_ = x;
+ }
+
+ inline const string& cmd_new_c_options::
+ txx () const
+ {
+ return this->txx_;
+ }
+
+ inline string& cmd_new_c_options::
+ txx ()
+ {
+ return this->txx_;
+ }
+
+ inline void cmd_new_c_options::
+ txx (const string& x)
+ {
+ this->txx_ = x;
+ }
+
+ inline bool cmd_new_c_options::
+ txx_specified () const
+ {
+ return this->txx_specified_;
+ }
+
+ inline void cmd_new_c_options::
+ txx_specified (bool x)
+ {
+ this->txx_specified_ = x;
+ }
+
+ inline const string& cmd_new_c_options::
+ mxx () const
+ {
+ return this->mxx_;
+ }
+
+ inline string& cmd_new_c_options::
+ mxx ()
+ {
+ return this->mxx_;
+ }
+
+ inline void cmd_new_c_options::
+ mxx (const string& x)
+ {
+ this->mxx_ = x;
+ }
+
+ inline bool cmd_new_c_options::
+ mxx_specified () const
+ {
+ return this->mxx_specified_;
+ }
+
+ inline void cmd_new_c_options::
+ mxx_specified (bool x)
+ {
+ this->mxx_specified_ = x;
+ }
+
+ // cmd_new_cxx_options
+ //
+
+ inline const bool& cmd_new_cxx_options::
+ cpp () const
+ {
+ return this->cpp_;
+ }
+
+ inline bool& cmd_new_cxx_options::
+ cpp ()
+ {
+ return this->cpp_;
+ }
+
+ inline void cmd_new_cxx_options::
+ cpp (const bool& x)
+ {
+ this->cpp_ = x;
+ }
+
+ inline const string& cmd_new_cxx_options::
+ extension () const
+ {
+ return this->extension_;
+ }
+
+ inline string& cmd_new_cxx_options::
+ extension ()
+ {
+ return this->extension_;
+ }
+
+ inline void cmd_new_cxx_options::
+ extension (const string& x)
+ {
+ this->extension_ = x;
+ }
+
+ inline bool cmd_new_cxx_options::
+ extension_specified () const
+ {
+ return this->extension_specified_;
+ }
+
+ inline void cmd_new_cxx_options::
+ extension_specified (bool x)
+ {
+ this->extension_specified_ = x;
+ }
+
+ inline const string& cmd_new_cxx_options::
+ hxx () const
+ {
+ return this->hxx_;
+ }
+
+ inline string& cmd_new_cxx_options::
+ hxx ()
+ {
+ return this->hxx_;
+ }
+
+ inline void cmd_new_cxx_options::
+ hxx (const string& x)
+ {
+ this->hxx_ = x;
+ }
+
+ inline bool cmd_new_cxx_options::
+ hxx_specified () const
+ {
+ return this->hxx_specified_;
+ }
+
+ inline void cmd_new_cxx_options::
+ hxx_specified (bool x)
+ {
+ this->hxx_specified_ = x;
+ }
+
+ inline const string& cmd_new_cxx_options::
+ cxx () const
+ {
+ return this->cxx_;
+ }
+
+ inline string& cmd_new_cxx_options::
+ cxx ()
+ {
+ return this->cxx_;
+ }
+
+ inline void cmd_new_cxx_options::
+ cxx (const string& x)
+ {
+ this->cxx_ = x;
+ }
+
+ inline bool cmd_new_cxx_options::
+ cxx_specified () const
+ {
+ return this->cxx_specified_;
+ }
+
+ inline void cmd_new_cxx_options::
+ cxx_specified (bool x)
+ {
+ this->cxx_specified_ = x;
+ }
+
+ inline const string& cmd_new_cxx_options::
+ ixx () const
+ {
+ return this->ixx_;
+ }
+
+ inline string& cmd_new_cxx_options::
+ ixx ()
+ {
+ return this->ixx_;
+ }
+
+ inline void cmd_new_cxx_options::
+ ixx (const string& x)
+ {
+ this->ixx_ = x;
+ }
+
+ inline bool cmd_new_cxx_options::
+ ixx_specified () const
+ {
+ return this->ixx_specified_;
+ }
+
+ inline void cmd_new_cxx_options::
+ ixx_specified (bool x)
+ {
+ this->ixx_specified_ = x;
+ }
+
+ inline const string& cmd_new_cxx_options::
+ txx () const
+ {
+ return this->txx_;
+ }
+
+ inline string& cmd_new_cxx_options::
+ txx ()
+ {
+ return this->txx_;
+ }
+
+ inline void cmd_new_cxx_options::
+ txx (const string& x)
+ {
+ this->txx_ = x;
+ }
+
+ inline bool cmd_new_cxx_options::
+ txx_specified () const
+ {
+ return this->txx_specified_;
+ }
+
+ inline void cmd_new_cxx_options::
+ txx_specified (bool x)
+ {
+ this->txx_specified_ = x;
+ }
+
+ inline const string& cmd_new_cxx_options::
+ mxx () const
+ {
+ return this->mxx_;
+ }
+
+ inline string& cmd_new_cxx_options::
+ mxx ()
+ {
+ return this->mxx_;
+ }
+
+ inline void cmd_new_cxx_options::
+ mxx (const string& x)
+ {
+ this->mxx_ = x;
+ }
+
+ inline bool cmd_new_cxx_options::
+ mxx_specified () const
+ {
+ return this->mxx_specified_;
+ }
+
+ inline void cmd_new_cxx_options::
+ mxx_specified (bool x)
+ {
+ this->mxx_specified_ = x;
+ }
+
+ inline const bool& cmd_new_cxx_options::
+ c () const
+ {
+ return this->c_;
+ }
+
+ inline bool& cmd_new_cxx_options::
+ c ()
+ {
+ return this->c_;
+ }
+
+ inline void cmd_new_cxx_options::
+ c (const bool& x)
+ {
+ this->c_ = x;
+ }
+
+ // cmd_new_exe_options
+ //
+
+ inline const bool& cmd_new_exe_options::
+ no_tests () const
+ {
+ return this->no_tests_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ no_tests ()
+ {
+ return this->no_tests_;
+ }
+
+ inline void cmd_new_exe_options::
+ no_tests (const bool& x)
+ {
+ this->no_tests_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ unit_tests () const
+ {
+ return this->unit_tests_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ unit_tests ()
+ {
+ return this->unit_tests_;
+ }
+
+ inline void cmd_new_exe_options::
+ unit_tests (const bool& x)
+ {
+ this->unit_tests_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ no_install () const
+ {
+ return this->no_install_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ no_install ()
+ {
+ return this->no_install_;
+ }
+
+ inline void cmd_new_exe_options::
+ no_install (const bool& x)
+ {
+ this->no_install_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ export_stub () const
+ {
+ return this->export_stub_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ export_stub ()
+ {
+ return this->export_stub_;
+ }
+
+ inline void cmd_new_exe_options::
+ export_stub (const bool& x)
+ {
+ this->export_stub_ = x;
+ }
+
+ inline const dir_path& cmd_new_exe_options::
+ prefix () const
+ {
+ return this->prefix_;
+ }
+
+ inline dir_path& cmd_new_exe_options::
+ prefix ()
+ {
+ return this->prefix_;
+ }
+
+ inline void cmd_new_exe_options::
+ prefix (const dir_path& x)
+ {
+ this->prefix_ = x;
+ }
+
+ inline bool cmd_new_exe_options::
+ prefix_specified () const
+ {
+ return this->prefix_specified_;
+ }
+
+ inline void cmd_new_exe_options::
+ prefix_specified (bool x)
+ {
+ this->prefix_specified_ = x;
+ }
+
+ inline const dir_path& cmd_new_exe_options::
+ subdir () const
+ {
+ return this->subdir_;
+ }
+
+ inline dir_path& cmd_new_exe_options::
+ subdir ()
+ {
+ return this->subdir_;
+ }
+
+ inline void cmd_new_exe_options::
+ subdir (const dir_path& x)
+ {
+ this->subdir_ = x;
+ }
+
+ inline bool cmd_new_exe_options::
+ subdir_specified () const
+ {
+ return this->subdir_specified_;
+ }
+
+ inline void cmd_new_exe_options::
+ subdir_specified (bool x)
+ {
+ this->subdir_specified_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ no_subdir () const
+ {
+ return this->no_subdir_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ no_subdir ()
+ {
+ return this->no_subdir_;
+ }
+
+ inline void cmd_new_exe_options::
+ no_subdir (const bool& x)
+ {
+ this->no_subdir_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ buildfile_in_prefix () const
+ {
+ return this->buildfile_in_prefix_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ buildfile_in_prefix ()
+ {
+ return this->buildfile_in_prefix_;
+ }
+
+ inline void cmd_new_exe_options::
+ buildfile_in_prefix (const bool& x)
+ {
+ this->buildfile_in_prefix_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ third_party () const
+ {
+ return this->third_party_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ third_party ()
+ {
+ return this->third_party_;
+ }
+
+ inline void cmd_new_exe_options::
+ third_party (const bool& x)
+ {
+ this->third_party_ = x;
+ }
+
+ inline const string& cmd_new_exe_options::
+ license () const
+ {
+ return this->license_;
+ }
+
+ inline string& cmd_new_exe_options::
+ license ()
+ {
+ return this->license_;
+ }
+
+ inline void cmd_new_exe_options::
+ license (const string& x)
+ {
+ this->license_ = x;
+ }
+
+ inline bool cmd_new_exe_options::
+ license_specified () const
+ {
+ return this->license_specified_;
+ }
+
+ inline void cmd_new_exe_options::
+ license_specified (bool x)
+ {
+ this->license_specified_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ no_readme () const
+ {
+ return this->no_readme_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ no_readme ()
+ {
+ return this->no_readme_;
+ }
+
+ inline void cmd_new_exe_options::
+ no_readme (const bool& x)
+ {
+ this->no_readme_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ no_package_readme () const
+ {
+ return this->no_package_readme_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ no_package_readme ()
+ {
+ return this->no_package_readme_;
+ }
+
+ inline void cmd_new_exe_options::
+ no_package_readme (const bool& x)
+ {
+ this->no_package_readme_ = x;
+ }
+
+ inline const bool& cmd_new_exe_options::
+ alt_naming () const
+ {
+ return this->alt_naming_;
+ }
+
+ inline bool& cmd_new_exe_options::
+ alt_naming ()
+ {
+ return this->alt_naming_;
+ }
+
+ inline void cmd_new_exe_options::
+ alt_naming (const bool& x)
+ {
+ this->alt_naming_ = x;
+ }
+
+ // cmd_new_lib_options
+ //
+
+ inline const bool& cmd_new_lib_options::
+ binless () const
+ {
+ return this->binless_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ binless ()
+ {
+ return this->binless_;
+ }
+
+ inline void cmd_new_lib_options::
+ binless (const bool& x)
+ {
+ this->binless_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_tests () const
+ {
+ return this->no_tests_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_tests ()
+ {
+ return this->no_tests_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_tests (const bool& x)
+ {
+ this->no_tests_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ unit_tests () const
+ {
+ return this->unit_tests_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ unit_tests ()
+ {
+ return this->unit_tests_;
+ }
+
+ inline void cmd_new_lib_options::
+ unit_tests (const bool& x)
+ {
+ this->unit_tests_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_install () const
+ {
+ return this->no_install_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_install ()
+ {
+ return this->no_install_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_install (const bool& x)
+ {
+ this->no_install_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_version () const
+ {
+ return this->no_version_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_version ()
+ {
+ return this->no_version_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_version (const bool& x)
+ {
+ this->no_version_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_symexport () const
+ {
+ return this->no_symexport_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_symexport ()
+ {
+ return this->no_symexport_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_symexport (const bool& x)
+ {
+ this->no_symexport_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ auto_symexport () const
+ {
+ return this->auto_symexport_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ auto_symexport ()
+ {
+ return this->auto_symexport_;
+ }
+
+ inline void cmd_new_lib_options::
+ auto_symexport (const bool& x)
+ {
+ this->auto_symexport_ = x;
+ }
+
+ inline const dir_path& cmd_new_lib_options::
+ prefix_include () const
+ {
+ return this->prefix_include_;
+ }
+
+ inline dir_path& cmd_new_lib_options::
+ prefix_include ()
+ {
+ return this->prefix_include_;
+ }
+
+ inline void cmd_new_lib_options::
+ prefix_include (const dir_path& x)
+ {
+ this->prefix_include_ = x;
+ }
+
+ inline bool cmd_new_lib_options::
+ prefix_include_specified () const
+ {
+ return this->prefix_include_specified_;
+ }
+
+ inline void cmd_new_lib_options::
+ prefix_include_specified (bool x)
+ {
+ this->prefix_include_specified_ = x;
+ }
+
+ inline const dir_path& cmd_new_lib_options::
+ prefix_source () const
+ {
+ return this->prefix_source_;
+ }
+
+ inline dir_path& cmd_new_lib_options::
+ prefix_source ()
+ {
+ return this->prefix_source_;
+ }
+
+ inline void cmd_new_lib_options::
+ prefix_source (const dir_path& x)
+ {
+ this->prefix_source_ = x;
+ }
+
+ inline bool cmd_new_lib_options::
+ prefix_source_specified () const
+ {
+ return this->prefix_source_specified_;
+ }
+
+ inline void cmd_new_lib_options::
+ prefix_source_specified (bool x)
+ {
+ this->prefix_source_specified_ = x;
+ }
+
+ inline const dir_path& cmd_new_lib_options::
+ prefix () const
+ {
+ return this->prefix_;
+ }
+
+ inline dir_path& cmd_new_lib_options::
+ prefix ()
+ {
+ return this->prefix_;
+ }
+
+ inline void cmd_new_lib_options::
+ prefix (const dir_path& x)
+ {
+ this->prefix_ = x;
+ }
+
+ inline bool cmd_new_lib_options::
+ prefix_specified () const
+ {
+ return this->prefix_specified_;
+ }
+
+ inline void cmd_new_lib_options::
+ prefix_specified (bool x)
+ {
+ this->prefix_specified_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ split () const
+ {
+ return this->split_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ split ()
+ {
+ return this->split_;
+ }
+
+ inline void cmd_new_lib_options::
+ split (const bool& x)
+ {
+ this->split_ = x;
+ }
+
+ inline const dir_path& cmd_new_lib_options::
+ subdir () const
+ {
+ return this->subdir_;
+ }
+
+ inline dir_path& cmd_new_lib_options::
+ subdir ()
+ {
+ return this->subdir_;
+ }
+
+ inline void cmd_new_lib_options::
+ subdir (const dir_path& x)
+ {
+ this->subdir_ = x;
+ }
+
+ inline bool cmd_new_lib_options::
+ subdir_specified () const
+ {
+ return this->subdir_specified_;
+ }
+
+ inline void cmd_new_lib_options::
+ subdir_specified (bool x)
+ {
+ this->subdir_specified_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_subdir_include () const
+ {
+ return this->no_subdir_include_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_subdir_include ()
+ {
+ return this->no_subdir_include_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_subdir_include (const bool& x)
+ {
+ this->no_subdir_include_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_subdir_source () const
+ {
+ return this->no_subdir_source_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_subdir_source ()
+ {
+ return this->no_subdir_source_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_subdir_source (const bool& x)
+ {
+ this->no_subdir_source_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_subdir () const
+ {
+ return this->no_subdir_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_subdir ()
+ {
+ return this->no_subdir_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_subdir (const bool& x)
+ {
+ this->no_subdir_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ buildfile_in_prefix () const
+ {
+ return this->buildfile_in_prefix_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ buildfile_in_prefix ()
+ {
+ return this->buildfile_in_prefix_;
+ }
+
+ inline void cmd_new_lib_options::
+ buildfile_in_prefix (const bool& x)
+ {
+ this->buildfile_in_prefix_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ third_party () const
+ {
+ return this->third_party_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ third_party ()
+ {
+ return this->third_party_;
+ }
+
+ inline void cmd_new_lib_options::
+ third_party (const bool& x)
+ {
+ this->third_party_ = x;
+ }
+
+ inline const string& cmd_new_lib_options::
+ license () const
+ {
+ return this->license_;
+ }
+
+ inline string& cmd_new_lib_options::
+ license ()
+ {
+ return this->license_;
+ }
+
+ inline void cmd_new_lib_options::
+ license (const string& x)
+ {
+ this->license_ = x;
+ }
+
+ inline bool cmd_new_lib_options::
+ license_specified () const
+ {
+ return this->license_specified_;
+ }
+
+ inline void cmd_new_lib_options::
+ license_specified (bool x)
+ {
+ this->license_specified_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_readme () const
+ {
+ return this->no_readme_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_readme ()
+ {
+ return this->no_readme_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_readme (const bool& x)
+ {
+ this->no_readme_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ no_package_readme () const
+ {
+ return this->no_package_readme_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ no_package_readme ()
+ {
+ return this->no_package_readme_;
+ }
+
+ inline void cmd_new_lib_options::
+ no_package_readme (const bool& x)
+ {
+ this->no_package_readme_ = x;
+ }
+
+ inline const bool& cmd_new_lib_options::
+ alt_naming () const
+ {
+ return this->alt_naming_;
+ }
+
+ inline bool& cmd_new_lib_options::
+ alt_naming ()
+ {
+ return this->alt_naming_;
+ }
+
+ inline void cmd_new_lib_options::
+ alt_naming (const bool& x)
+ {
+ this->alt_naming_ = x;
+ }
+
+ // cmd_new_bare_options
+ //
+
+ inline const bool& cmd_new_bare_options::
+ no_tests () const
+ {
+ return this->no_tests_;
+ }
+
+ inline bool& cmd_new_bare_options::
+ no_tests ()
+ {
+ return this->no_tests_;
+ }
+
+ inline void cmd_new_bare_options::
+ no_tests (const bool& x)
+ {
+ this->no_tests_ = x;
+ }
+
+ inline const bool& cmd_new_bare_options::
+ no_install () const
+ {
+ return this->no_install_;
+ }
+
+ inline bool& cmd_new_bare_options::
+ no_install ()
+ {
+ return this->no_install_;
+ }
+
+ inline void cmd_new_bare_options::
+ no_install (const bool& x)
+ {
+ this->no_install_ = x;
+ }
+
+ inline const string& cmd_new_bare_options::
+ license () const
+ {
+ return this->license_;
+ }
+
+ inline string& cmd_new_bare_options::
+ license ()
+ {
+ return this->license_;
+ }
+
+ inline void cmd_new_bare_options::
+ license (const string& x)
+ {
+ this->license_ = x;
+ }
+
+ inline bool cmd_new_bare_options::
+ license_specified () const
+ {
+ return this->license_specified_;
+ }
+
+ inline void cmd_new_bare_options::
+ license_specified (bool x)
+ {
+ this->license_specified_ = x;
+ }
+
+ inline const bool& cmd_new_bare_options::
+ no_readme () const
+ {
+ return this->no_readme_;
+ }
+
+ inline bool& cmd_new_bare_options::
+ no_readme ()
+ {
+ return this->no_readme_;
+ }
+
+ inline void cmd_new_bare_options::
+ no_readme (const bool& x)
+ {
+ this->no_readme_ = x;
+ }
+
+ inline const bool& cmd_new_bare_options::
+ alt_naming () const
+ {
+ return this->alt_naming_;
+ }
+
+ inline bool& cmd_new_bare_options::
+ alt_naming ()
+ {
+ return this->alt_naming_;
+ }
+
+ inline void cmd_new_bare_options::
+ alt_naming (const bool& x)
+ {
+ this->alt_naming_ = x;
+ }
+
+ // cmd_new_empty_options
+ //
+
+ inline const bool& cmd_new_empty_options::
+ third_party () const
+ {
+ return this->third_party_;
+ }
+
+ inline bool& cmd_new_empty_options::
+ third_party ()
+ {
+ return this->third_party_;
+ }
+
+ inline void cmd_new_empty_options::
+ third_party (const bool& x)
+ {
+ this->third_party_ = x;
+ }
+
+ inline const bool& cmd_new_empty_options::
+ no_readme () const
+ {
+ return this->no_readme_;
+ }
+
+ inline bool& cmd_new_empty_options::
+ no_readme ()
+ {
+ return this->no_readme_;
+ }
+
+ inline void cmd_new_empty_options::
+ no_readme (const bool& x)
+ {
+ this->no_readme_ = x;
+ }
+
+ // cmd_new_git_options
+ //
+
+ inline const string& cmd_new_git_options::
+ branch () const
+ {
+ return this->branch_;
+ }
+
+ inline string& cmd_new_git_options::
+ branch ()
+ {
+ return this->branch_;
+ }
+
+ inline void cmd_new_git_options::
+ branch (const string& x)
+ {
+ this->branch_ = x;
+ }
+
+ inline bool cmd_new_git_options::
+ branch_specified () const
+ {
+ return this->branch_specified_;
+ }
+
+ inline void cmd_new_git_options::
+ branch_specified (bool x)
+ {
+ this->branch_specified_ = x;
+ }
+
+ // cmd_new_none_options
+ //
+
+ // cmd_new_options
+ //
+
+ inline const bool& cmd_new_options::
+ no_init () const
+ {
+ return this->no_init_;
+ }
+
+ inline bool& cmd_new_options::
+ no_init ()
+ {
+ return this->no_init_;
+ }
+
+ inline void cmd_new_options::
+ no_init (const bool& x)
+ {
+ this->no_init_ = x;
+ }
+
+ inline const bool& cmd_new_options::
+ package () const
+ {
+ return this->package_;
+ }
+
+ inline bool& cmd_new_options::
+ package ()
+ {
+ return this->package_;
+ }
+
+ inline void cmd_new_options::
+ package (const bool& x)
+ {
+ this->package_ = x;
+ }
+
+ inline const bool& cmd_new_options::
+ source () const
+ {
+ return this->source_;
+ }
+
+ inline bool& cmd_new_options::
+ source ()
+ {
+ return this->source_;
+ }
+
+ inline void cmd_new_options::
+ source (const bool& x)
+ {
+ this->source_ = x;
+ }
+
+ inline const dir_path& cmd_new_options::
+ output_dir () const
+ {
+ return this->output_dir_;
+ }
+
+ inline dir_path& cmd_new_options::
+ output_dir ()
+ {
+ return this->output_dir_;
+ }
+
+ inline void cmd_new_options::
+ output_dir (const dir_path& x)
+ {
+ this->output_dir_ = x;
+ }
+
+ inline bool cmd_new_options::
+ output_dir_specified () const
+ {
+ return this->output_dir_specified_;
+ }
+
+ inline void cmd_new_options::
+ output_dir_specified (bool x)
+ {
+ this->output_dir_specified_ = x;
+ }
+
+ inline const dir_path& cmd_new_options::
+ directory () const
+ {
+ return this->directory_;
+ }
+
+ inline dir_path& cmd_new_options::
+ directory ()
+ {
+ return this->directory_;
+ }
+
+ inline void cmd_new_options::
+ directory (const dir_path& x)
+ {
+ this->directory_ = x;
+ }
+
+ inline bool cmd_new_options::
+ directory_specified () const
+ {
+ return this->directory_specified_;
+ }
+
+ inline void cmd_new_options::
+ directory_specified (bool x)
+ {
+ this->directory_specified_ = x;
+ }
+
+ inline const cmd_new_type& cmd_new_options::
+ type () const
+ {
+ return this->type_;
+ }
+
+ inline cmd_new_type& cmd_new_options::
+ type ()
+ {
+ return this->type_;
+ }
+
+ inline void cmd_new_options::
+ type (const cmd_new_type& x)
+ {
+ this->type_ = x;
+ }
+
+ inline bool cmd_new_options::
+ type_specified () const
+ {
+ return this->type_specified_;
+ }
+
+ inline void cmd_new_options::
+ type_specified (bool x)
+ {
+ this->type_specified_ = x;
+ }
+
+ inline const cmd_new_lang& cmd_new_options::
+ lang () const
+ {
+ return this->lang_;
+ }
+
+ inline cmd_new_lang& cmd_new_options::
+ lang ()
+ {
+ return this->lang_;
+ }
+
+ inline void cmd_new_options::
+ lang (const cmd_new_lang& x)
+ {
+ this->lang_ = x;
+ }
+
+ inline bool cmd_new_options::
+ lang_specified () const
+ {
+ return this->lang_specified_;
+ }
+
+ inline void cmd_new_options::
+ lang_specified (bool x)
+ {
+ this->lang_specified_ = x;
+ }
+
+ inline const cmd_new_vcs& cmd_new_options::
+ vcs () const
+ {
+ return this->vcs_;
+ }
+
+ inline cmd_new_vcs& cmd_new_options::
+ vcs ()
+ {
+ return this->vcs_;
+ }
+
+ inline void cmd_new_options::
+ vcs (const cmd_new_vcs& x)
+ {
+ this->vcs_ = x;
+ }
+
+ inline bool cmd_new_options::
+ vcs_specified () const
+ {
+ return this->vcs_specified_;
+ }
+
+ inline void cmd_new_options::
+ vcs_specified (bool x)
+ {
+ this->vcs_specified_ = x;
+ }
+
+ inline const strings& cmd_new_options::
+ pre_hook () const
+ {
+ return this->pre_hook_;
+ }
+
+ inline strings& cmd_new_options::
+ pre_hook ()
+ {
+ return this->pre_hook_;
+ }
+
+ inline void cmd_new_options::
+ pre_hook (const strings& x)
+ {
+ this->pre_hook_ = x;
+ }
+
+ inline bool cmd_new_options::
+ pre_hook_specified () const
+ {
+ return this->pre_hook_specified_;
+ }
+
+ inline void cmd_new_options::
+ pre_hook_specified (bool x)
+ {
+ this->pre_hook_specified_ = x;
+ }
+
+ inline const strings& cmd_new_options::
+ post_hook () const
+ {
+ return this->post_hook_;
+ }
+
+ inline strings& cmd_new_options::
+ post_hook ()
+ {
+ return this->post_hook_;
+ }
+
+ inline void cmd_new_options::
+ post_hook (const strings& x)
+ {
+ this->post_hook_ = x;
+ }
+
+ inline bool cmd_new_options::
+ post_hook_specified () const
+ {
+ return this->post_hook_specified_;
+ }
+
+ inline void cmd_new_options::
+ post_hook_specified (bool x)
+ {
+ this->post_hook_specified_ = x;
+ }
+
+ inline const bool& cmd_new_options::
+ no_amalgamation () const
+ {
+ return this->no_amalgamation_;
+ }
+
+ inline bool& cmd_new_options::
+ no_amalgamation ()
+ {
+ return this->no_amalgamation_;
+ }
+
+ inline void cmd_new_options::
+ no_amalgamation (const bool& x)
+ {
+ this->no_amalgamation_ = x;
+ }
+
+ inline const bool& cmd_new_options::
+ no_checks () const
+ {
+ return this->no_checks_;
+ }
+
+ inline bool& cmd_new_options::
+ no_checks ()
+ {
+ return this->no_checks_;
+ }
+
+ inline void cmd_new_options::
+ no_checks (const bool& x)
+ {
+ this->no_checks_ = x;
+ }
+
+ inline const dir_path& cmd_new_options::
+ config_add () const
+ {
+ return this->config_add_;
+ }
+
+ inline dir_path& cmd_new_options::
+ config_add ()
+ {
+ return this->config_add_;
+ }
+
+ inline void cmd_new_options::
+ config_add (const dir_path& x)
+ {
+ this->config_add_ = x;
+ }
+
+ inline bool cmd_new_options::
+ config_add_specified () const
+ {
+ return this->config_add_specified_;
+ }
+
+ inline void cmd_new_options::
+ config_add_specified (bool x)
+ {
+ this->config_add_specified_ = x;
+ }
+
+ inline const dir_path& cmd_new_options::
+ config_create () const
+ {
+ return this->config_create_;
+ }
+
+ inline dir_path& cmd_new_options::
+ config_create ()
+ {
+ return this->config_create_;
+ }
+
+ inline void cmd_new_options::
+ config_create (const dir_path& x)
+ {
+ this->config_create_ = x;
+ }
+
+ inline bool cmd_new_options::
+ config_create_specified () const
+ {
+ return this->config_create_specified_;
+ }
+
+ inline void cmd_new_options::
+ config_create_specified (bool x)
+ {
+ this->config_create_specified_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/project-odb.cxx b/bdep/project-odb.cxx
new file mode 100644
index 0000000..4e8bf86
--- /dev/null
+++ b/bdep/project-odb.cxx
@@ -0,0 +1,1676 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#include <odb/pre.hxx>
+
+#include <bdep/project-odb.hxx>
+
+#include <cassert>
+#include <cstring> // std::memcpy
+
+#include <odb/schema-catalog-impl.hxx>
+
+#include <odb/sqlite/traits.hxx>
+#include <odb/sqlite/database.hxx>
+#include <odb/sqlite/transaction.hxx>
+#include <odb/sqlite/connection.hxx>
+#include <odb/sqlite/statement.hxx>
+#include <odb/sqlite/statement-cache.hxx>
+#include <odb/sqlite/simple-object-statements.hxx>
+#include <odb/sqlite/view-statements.hxx>
+#include <odb/sqlite/container-statements.hxx>
+#include <odb/sqlite/exceptions.hxx>
+#include <odb/sqlite/simple-object-result.hxx>
+#include <odb/sqlite/view-result.hxx>
+
+namespace odb
+{
+ // package_state
+ //
+
+ bool access::composite_value_traits< ::bdep::package_state, id_sqlite >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // name
+ //
+ if (t[0UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bdep::package_state, id_sqlite >::
+ bind (sqlite::bind* b,
+ image_type& i,
+ sqlite::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (b);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace sqlite;
+
+ std::size_t n (0);
+ ODB_POTENTIALLY_UNUSED (n);
+
+ // name
+ //
+ b[n].type = sqlite::image_traits<
+ ::bpkg::package_name,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.name_value.data ();
+ b[n].size = &i.name_size;
+ b[n].capacity = i.name_value.capacity ();
+ b[n].is_null = &i.name_null;
+ n++;
+ }
+
+ bool access::composite_value_traits< ::bdep::package_state, id_sqlite >::
+ init (image_type& i,
+ const value_type& o,
+ sqlite::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace sqlite;
+
+ bool grew (false);
+
+ // name
+ //
+ {
+ ::bpkg::package_name const& v =
+ o.name;
+
+ bool is_null (false);
+ std::size_t cap (i.name_value.capacity ());
+ sqlite::value_traits<
+ ::bpkg::package_name,
+ sqlite::id_text >::set_image (
+ i.name_value,
+ i.name_size,
+ is_null,
+ v);
+ i.name_null = is_null;
+ grew = grew || (cap != i.name_value.capacity ());
+ }
+
+ return grew;
+ }
+
+ void access::composite_value_traits< ::bdep::package_state, id_sqlite >::
+ init (value_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // name
+ //
+ {
+ ::bpkg::package_name& v =
+ o.name;
+
+ sqlite::value_traits<
+ ::bpkg::package_name,
+ sqlite::id_text >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+ }
+
+ // configuration
+ //
+
+ struct access::object_traits_impl< ::bdep::configuration, id_sqlite >::extra_statement_cache_type
+ {
+ sqlite::container_statements_impl< packages_traits > packages;
+
+ extra_statement_cache_type (
+ sqlite::connection& c,
+ image_type&,
+ id_image_type&,
+ sqlite::binding& id,
+ sqlite::binding&)
+ : packages (c, id)
+ {
+ }
+ };
+
+ // packages
+ //
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ select_statement[] =
+ "SELECT "
+ "\"configuration_packages\".\"index\", "
+ "\"configuration_packages\".\"name\" "
+ "FROM \"configuration_packages\" "
+ "WHERE \"configuration_packages\".\"object_id\"=? ORDER BY \"configuration_packages\".\"index\"";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ insert_statement[] =
+ "INSERT INTO \"configuration_packages\" "
+ "(\"object_id\", "
+ "\"index\", "
+ "\"name\") "
+ "VALUES "
+ "(?, ?, ?)";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ delete_statement[] =
+ "DELETE FROM \"configuration_packages\" "
+ "WHERE \"object_id\"=?";
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ bind (sqlite::bind* b,
+ const sqlite::bind* id,
+ std::size_t id_size,
+ data_image_type& d)
+ {
+ using namespace sqlite;
+
+ statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ size_t n (0);
+
+ // object_id
+ //
+ if (id != 0)
+ std::memcpy (&b[n], id, id_size * sizeof (id[0]));
+ n += id_size;
+
+ // index
+ //
+ b[n].type = sqlite::bind::integer;
+ b[n].buffer = &d.index_value;
+ b[n].is_null = &d.index_null;
+ n++;
+
+ // value
+ //
+ composite_value_traits< value_type, id_sqlite >::bind (
+ b + n, d.value_value, sk);
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ grow (data_image_type& i,
+ bool* t)
+ {
+ bool grew (false);
+
+ // index
+ //
+ t[0UL] = false;
+
+ // value
+ //
+ if (composite_value_traits< value_type, id_sqlite >::grow (
+ i.value_value, t + 1UL))
+ grew = true;
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ init (data_image_type& i,
+ index_type* j,
+ const value_type& v)
+ {
+ using namespace sqlite;
+
+ statement_kind sk (statement_insert);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ bool grew (false);
+
+ // index
+ //
+ if (j != 0)
+ {
+ bool is_null (false);
+ sqlite::value_traits<
+ index_type,
+ sqlite::id_integer >::set_image (
+ i.index_value,
+ is_null,
+ *j);
+ i.index_null = is_null;
+ }
+
+ // value
+ //
+ {
+ if (composite_value_traits< value_type, id_sqlite >::init (
+ i.value_value,
+ v,
+ sk))
+ grew = true;
+ }
+
+ if (grew)
+ i.version++;
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ init (index_type& j,
+ value_type& v,
+ const data_image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // index
+ //
+ {
+ sqlite::value_traits<
+ index_type,
+ sqlite::id_integer >::set_value (
+ j,
+ i.index_value,
+ i.index_null);
+ }
+
+ // value
+ //
+ {
+ composite_value_traits< value_type, id_sqlite >::init (
+ v,
+ i.value_value,
+ db);
+ }
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ insert (index_type i, const value_type& v, void* d)
+ {
+ using namespace sqlite;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (di, &i, v);
+
+ if (sts.data_binding_test_version ())
+ {
+ const binding& id (sts.id_binding ());
+ bind (sts.data_bind (), id.bind, id.count, di);
+ sts.data_binding_update_version ();
+ }
+
+ if (!sts.insert_statement ().execute ())
+ throw object_already_persistent ();
+ }
+
+ bool access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ select (index_type& i, value_type& v, void* d)
+ {
+ using namespace sqlite;
+ using sqlite::select_statement;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ data_image_type& di (sts.data_image ());
+
+ init (i, v, di, &sts.connection ().database ());
+
+ select_statement& st (sts.select_statement ());
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, sts.id_binding ().count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ delete_ (void* d)
+ {
+ using namespace sqlite;
+
+ statements_type& sts (*static_cast< statements_type* > (d));
+ sts.delete_statement ().execute ();
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ persist (const container_type& c,
+ statements_type& sts)
+ {
+ using namespace sqlite;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::persist (c, fs);
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ load (container_type& c,
+ statements_type& sts)
+ {
+ using namespace sqlite;
+ using sqlite::select_statement;
+
+ const binding& id (sts.id_binding ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), id.bind, id.count, sts.data_image ());
+ sts.data_binding_update_version ();
+ }
+
+ select_statement& st (sts.select_statement ());
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ data_image_type& di (sts.data_image ());
+ grow (di, sts.select_image_truncated ());
+
+ if (sts.data_binding_test_version ())
+ {
+ bind (sts.data_bind (), 0, id.count, di);
+ sts.data_binding_update_version ();
+ st.refetch ();
+ }
+ }
+
+ bool more (r != select_statement::no_data);
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::load (c, more, fs);
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ update (const container_type& c,
+ statements_type& sts)
+ {
+ using namespace sqlite;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::update (c, fs);
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::packages_traits::
+ erase (statements_type& sts)
+ {
+ using namespace sqlite;
+
+ functions_type& fs (sts.functions ());
+ fs.ordered_ = true;
+ container_traits_type::erase (fs);
+ }
+
+ access::object_traits_impl< ::bdep::configuration, id_sqlite >::id_type
+ access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ id (const id_image_type& i)
+ {
+ sqlite::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ sqlite::value_traits<
+ ::bdep::optional_uint64_t,
+ sqlite::id_integer >::set_value (
+ id,
+ i.id_value,
+ i.id_null);
+ }
+
+ return id;
+ }
+
+ access::object_traits_impl< ::bdep::configuration, id_sqlite >::id_type
+ access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ id (const image_type& i)
+ {
+ sqlite::database* db (0);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ id_type id;
+ {
+ sqlite::value_traits<
+ ::bdep::optional_uint64_t,
+ sqlite::id_integer >::set_value (
+ id,
+ i.id_value,
+ i.id_null);
+ }
+
+ return id;
+ }
+
+ bool access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // id
+ //
+ t[0UL] = false;
+
+ // name
+ //
+ if (t[1UL])
+ {
+ i.name_value.capacity (i.name_size);
+ grew = true;
+ }
+
+ // type
+ //
+ if (t[2UL])
+ {
+ i.type_value.capacity (i.type_size);
+ grew = true;
+ }
+
+ // path
+ //
+ if (t[3UL])
+ {
+ i.path_value.capacity (i.path_size);
+ grew = true;
+ }
+
+ // relative_path
+ //
+ if (t[4UL])
+ {
+ i.relative_path_value.capacity (i.relative_path_size);
+ grew = true;
+ }
+
+ // default_
+ //
+ t[5UL] = false;
+
+ // forward
+ //
+ t[6UL] = false;
+
+ // auto_sync
+ //
+ t[7UL] = false;
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ bind (sqlite::bind* b,
+ image_type& i,
+ sqlite::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace sqlite;
+
+ std::size_t n (0);
+
+ // id
+ //
+ if (sk != statement_update)
+ {
+ b[n].type = sqlite::bind::integer;
+ b[n].buffer = &i.id_value;
+ b[n].is_null = &i.id_null;
+ n++;
+ }
+
+ // name
+ //
+ b[n].type = sqlite::image_traits<
+ ::bdep::optional_string,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.name_value.data ();
+ b[n].size = &i.name_size;
+ b[n].capacity = i.name_value.capacity ();
+ b[n].is_null = &i.name_null;
+ n++;
+
+ // type
+ //
+ b[n].type = sqlite::image_traits<
+ ::std::string,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.type_value.data ();
+ b[n].size = &i.type_size;
+ b[n].capacity = i.type_value.capacity ();
+ b[n].is_null = &i.type_null;
+ n++;
+
+ // path
+ //
+ b[n].type = sqlite::image_traits<
+ ::std::string,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.path_value.data ();
+ b[n].size = &i.path_size;
+ b[n].capacity = i.path_value.capacity ();
+ b[n].is_null = &i.path_null;
+ n++;
+
+ // relative_path
+ //
+ b[n].type = sqlite::image_traits<
+ ::bdep::optional_string,
+ sqlite::id_text>::bind_value;
+ b[n].buffer = i.relative_path_value.data ();
+ b[n].size = &i.relative_path_size;
+ b[n].capacity = i.relative_path_value.capacity ();
+ b[n].is_null = &i.relative_path_null;
+ n++;
+
+ // default_
+ //
+ b[n].type = sqlite::bind::integer;
+ b[n].buffer = &i.default_value;
+ b[n].is_null = &i.default_null;
+ n++;
+
+ // forward
+ //
+ b[n].type = sqlite::bind::integer;
+ b[n].buffer = &i.forward_value;
+ b[n].is_null = &i.forward_null;
+ n++;
+
+ // auto_sync
+ //
+ b[n].type = sqlite::bind::integer;
+ b[n].buffer = &i.auto_sync_value;
+ b[n].is_null = &i.auto_sync_null;
+ n++;
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ bind (sqlite::bind* b, id_image_type& i)
+ {
+ std::size_t n (0);
+ b[n].type = sqlite::bind::integer;
+ b[n].buffer = &i.id_value;
+ b[n].is_null = &i.id_null;
+ }
+
+ bool access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ init (image_type& i,
+ const object_type& o,
+ sqlite::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace sqlite;
+
+ bool grew (false);
+
+ // id
+ //
+ if (sk == statement_insert)
+ {
+ ::bdep::optional_uint64_t const& v =
+ o.id;
+
+ bool is_null (false);
+ sqlite::value_traits<
+ ::bdep::optional_uint64_t,
+ sqlite::id_integer >::set_image (
+ i.id_value,
+ is_null,
+ v);
+ i.id_null = is_null;
+ }
+
+ // name
+ //
+ {
+ ::bdep::optional_string const& v =
+ o.name;
+
+ bool is_null (true);
+ std::size_t cap (i.name_value.capacity ());
+ sqlite::value_traits<
+ ::bdep::optional_string,
+ sqlite::id_text >::set_image (
+ i.name_value,
+ i.name_size,
+ is_null,
+ v);
+ i.name_null = is_null;
+ grew = grew || (cap != i.name_value.capacity ());
+ }
+
+ // type
+ //
+ {
+ ::std::string const& v =
+ o.type;
+
+ bool is_null (false);
+ std::size_t cap (i.type_value.capacity ());
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::set_image (
+ i.type_value,
+ i.type_size,
+ is_null,
+ v);
+ i.type_null = is_null;
+ grew = grew || (cap != i.type_value.capacity ());
+ }
+
+ // path
+ //
+ {
+ ::butl::dir_path const& v =
+ o.path;
+
+ // From project.hxx:41:14
+ ::std::string const& vt =
+ (v).string ();
+
+ bool is_null (false);
+ std::size_t cap (i.path_value.capacity ());
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::set_image (
+ i.path_value,
+ i.path_size,
+ is_null,
+ vt);
+ i.path_null = is_null;
+ grew = grew || (cap != i.path_value.capacity ());
+ }
+
+ // relative_path
+ //
+ {
+ ::bdep::optional_dir_path const& v =
+ o.relative_path;
+
+ // From project.hxx:44:14
+ ::bdep::optional_string const& vt =
+ (v) ? (v)->string () : bdep::optional_string ();
+
+ bool is_null (true);
+ std::size_t cap (i.relative_path_value.capacity ());
+ sqlite::value_traits<
+ ::bdep::optional_string,
+ sqlite::id_text >::set_image (
+ i.relative_path_value,
+ i.relative_path_size,
+ is_null,
+ vt);
+ i.relative_path_null = is_null;
+ grew = grew || (cap != i.relative_path_value.capacity ());
+ }
+
+ // default_
+ //
+ {
+ bool const& v =
+ o.default_;
+
+ bool is_null (false);
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::set_image (
+ i.default_value,
+ is_null,
+ v);
+ i.default_null = is_null;
+ }
+
+ // forward
+ //
+ {
+ bool const& v =
+ o.forward;
+
+ bool is_null (false);
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::set_image (
+ i.forward_value,
+ is_null,
+ v);
+ i.forward_null = is_null;
+ }
+
+ // auto_sync
+ //
+ {
+ bool const& v =
+ o.auto_sync;
+
+ bool is_null (false);
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::set_image (
+ i.auto_sync_value,
+ is_null,
+ v);
+ i.auto_sync_null = is_null;
+ }
+
+ return grew;
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ init (object_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // id
+ //
+ {
+ ::bdep::optional_uint64_t& v =
+ o.id;
+
+ sqlite::value_traits<
+ ::bdep::optional_uint64_t,
+ sqlite::id_integer >::set_value (
+ v,
+ i.id_value,
+ i.id_null);
+ }
+
+ // name
+ //
+ {
+ ::bdep::optional_string& v =
+ o.name;
+
+ sqlite::value_traits<
+ ::bdep::optional_string,
+ sqlite::id_text >::set_value (
+ v,
+ i.name_value,
+ i.name_size,
+ i.name_null);
+ }
+
+ // type
+ //
+ {
+ ::std::string& v =
+ o.type;
+
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::set_value (
+ v,
+ i.type_value,
+ i.type_size,
+ i.type_null);
+ }
+
+ // path
+ //
+ {
+ ::butl::dir_path& v =
+ o.path;
+
+ ::std::string vt;
+
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::set_value (
+ vt,
+ i.path_value,
+ i.path_size,
+ i.path_null);
+
+ // From project.hxx:41:14
+ v = bdep::dir_path (vt);
+ }
+
+ // relative_path
+ //
+ {
+ ::bdep::optional_dir_path& v =
+ o.relative_path;
+
+ ::bdep::optional_string vt;
+
+ sqlite::value_traits<
+ ::bdep::optional_string,
+ sqlite::id_text >::set_value (
+ vt,
+ i.relative_path_value,
+ i.relative_path_size,
+ i.relative_path_null);
+
+ // From project.hxx:44:14
+ v = (vt) ? bdep::dir_path ( * (vt)) : bdep::optional_dir_path ();
+ }
+
+ // default_
+ //
+ {
+ bool& v =
+ o.default_;
+
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::set_value (
+ v,
+ i.default_value,
+ i.default_null);
+ }
+
+ // forward
+ //
+ {
+ bool& v =
+ o.forward;
+
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::set_value (
+ v,
+ i.forward_value,
+ i.forward_null);
+ }
+
+ // auto_sync
+ //
+ {
+ bool& v =
+ o.auto_sync;
+
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::set_value (
+ v,
+ i.auto_sync_value,
+ i.auto_sync_null);
+ }
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ init (id_image_type& i, const id_type& id)
+ {
+ {
+ bool is_null (false);
+ sqlite::value_traits<
+ ::bdep::optional_uint64_t,
+ sqlite::id_integer >::set_image (
+ i.id_value,
+ is_null,
+ id);
+ i.id_null = is_null;
+ }
+ }
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::persist_statement[] =
+ "INSERT INTO \"configuration\" "
+ "(\"id\", "
+ "\"name\", "
+ "\"type\", "
+ "\"path\", "
+ "\"relative_path\", "
+ "\"default\", "
+ "\"forward\", "
+ "\"auto_sync\") "
+ "VALUES "
+ "(?, ?, ?, ?, ?, ?, ?, ?)";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::find_statement[] =
+ "SELECT "
+ "\"configuration\".\"id\", "
+ "\"configuration\".\"name\", "
+ "\"configuration\".\"type\", "
+ "\"configuration\".\"path\", "
+ "\"configuration\".\"relative_path\", "
+ "\"configuration\".\"default\", "
+ "\"configuration\".\"forward\", "
+ "\"configuration\".\"auto_sync\" "
+ "FROM \"configuration\" "
+ "WHERE \"configuration\".\"id\"=?";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::update_statement[] =
+ "UPDATE \"configuration\" "
+ "SET "
+ "\"name\"=?, "
+ "\"type\"=?, "
+ "\"path\"=?, "
+ "\"relative_path\"=?, "
+ "\"default\"=?, "
+ "\"forward\"=?, "
+ "\"auto_sync\"=? "
+ "WHERE \"id\"=?";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::erase_statement[] =
+ "DELETE FROM \"configuration\" "
+ "WHERE \"id\"=?";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::query_statement[] =
+ "SELECT "
+ "\"configuration\".\"id\", "
+ "\"configuration\".\"name\", "
+ "\"configuration\".\"type\", "
+ "\"configuration\".\"path\", "
+ "\"configuration\".\"relative_path\", "
+ "\"configuration\".\"default\", "
+ "\"configuration\".\"forward\", "
+ "\"configuration\".\"auto_sync\" "
+ "FROM \"configuration\"";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::erase_query_statement[] =
+ "DELETE FROM \"configuration\"";
+
+ const char access::object_traits_impl< ::bdep::configuration, id_sqlite >::table_name[] =
+ "\"configuration\"";
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ persist (database& db, object_type& obj)
+ {
+ using namespace sqlite;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ callback (db,
+ static_cast<const object_type&> (obj),
+ callback_event::pre_persist);
+
+ image_type& im (sts.image ());
+ binding& imb (sts.insert_image_binding ());
+
+ if (init (im, obj, statement_insert))
+ im.version++;
+
+ if (im.version != sts.insert_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_insert);
+ sts.insert_image_version (im.version);
+ imb.version++;
+ }
+
+ {
+ id_image_type& i (sts.id_image ());
+ binding& b (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || b.version == 0)
+ {
+ bind (b.bind, i);
+ sts.id_image_version (i.version);
+ b.version++;
+ }
+ }
+
+ insert_statement& st (sts.persist_statement ());
+ if (!st.execute ())
+ throw object_already_persistent ();
+
+ obj.id = id (sts.id_image ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id (obj));
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // packages
+ //
+ {
+ ::std::vector< ::bdep::package_state > const& v =
+ obj.packages;
+
+ packages_traits::persist (
+ v,
+ esc.packages);
+ }
+
+ callback (db,
+ static_cast<const object_type&> (obj),
+ callback_event::post_persist);
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ update (database& db, const object_type& obj)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+
+ using namespace sqlite;
+ using sqlite::update_statement;
+
+ callback (db, obj, callback_event::pre_update);
+
+ sqlite::transaction& tr (sqlite::transaction::current ());
+ sqlite::connection& conn (tr.connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& idi (sts.id_image ());
+ init (idi, id (obj));
+
+ image_type& im (sts.image ());
+ if (init (im, obj, statement_update))
+ im.version++;
+
+ bool u (false);
+ binding& imb (sts.update_image_binding ());
+ if (im.version != sts.update_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_update);
+ sts.update_image_version (im.version);
+ imb.version++;
+ u = true;
+ }
+
+ binding& idb (sts.id_image_binding ());
+ if (idi.version != sts.update_id_image_version () ||
+ idb.version == 0)
+ {
+ if (idi.version != sts.id_image_version () ||
+ idb.version == 0)
+ {
+ bind (idb.bind, idi);
+ sts.id_image_version (idi.version);
+ idb.version++;
+ }
+
+ sts.update_id_image_version (idi.version);
+
+ if (!u)
+ imb.version++;
+ }
+
+ update_statement& st (sts.update_statement ());
+ if (st.execute () == 0)
+ throw object_not_persistent ();
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // packages
+ //
+ {
+ ::std::vector< ::bdep::package_state > const& v =
+ obj.packages;
+
+ packages_traits::update (
+ v,
+ esc.packages);
+ }
+
+ callback (db, obj, callback_event::post_update);
+ pointer_cache_traits::update (db, obj);
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ erase (database& db, const id_type& id)
+ {
+ using namespace sqlite;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ id_image_type& i (sts.id_image ());
+ init (i, id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // packages
+ //
+ {
+ packages_traits::erase (
+ esc.packages);
+ }
+
+ if (sts.erase_statement ().execute () != 1)
+ throw object_not_persistent ();
+
+ pointer_cache_traits::erase (db, id);
+ }
+
+ access::object_traits_impl< ::bdep::configuration, id_sqlite >::pointer_type
+ access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ find (database& db, const id_type& id)
+ {
+ using namespace sqlite;
+
+ {
+ pointer_type p (pointer_cache_traits::find (db, id));
+
+ if (!pointer_traits::null_ptr (p))
+ return p;
+ }
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+
+ if (l.locked ())
+ {
+ if (!find_ (sts, &id))
+ return pointer_type ();
+ }
+
+ pointer_type p (
+ access::object_factory<object_type, pointer_type>::create ());
+ pointer_traits::guard pg (p);
+
+ pointer_cache_traits::insert_guard ig (
+ pointer_cache_traits::insert (db, id, p));
+
+ object_type& obj (pointer_traits::get_ref (p));
+
+ if (l.locked ())
+ {
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ pointer_cache_traits::load (ig.position ());
+ }
+ else
+ sts.delay_load (id, obj, ig.position ());
+
+ ig.release ();
+ pg.release ();
+ return p;
+ }
+
+ bool access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ find (database& db, const id_type& id, object_type& obj)
+ {
+ using namespace sqlite;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ reference_cache_traits::position_type pos (
+ reference_cache_traits::insert (db, id, obj));
+ reference_cache_traits::insert_guard ig (pos);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, false);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ reference_cache_traits::load (pos);
+ ig.release ();
+ return true;
+ }
+
+ bool access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ reload (database& db, object_type& obj)
+ {
+ using namespace sqlite;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ statements_type::auto_lock l (sts);
+ assert (l.locked ()) /* Must be a top-level call. */;
+
+ const id_type& id (object_traits_impl::id (obj));
+ if (!find_ (sts, &id))
+ return false;
+
+ select_statement& st (sts.find_statement ());
+ ODB_POTENTIALLY_UNUSED (st);
+
+ callback (db, obj, callback_event::pre_load);
+ init (obj, sts.image (), &db);
+ load_ (sts, obj, true);
+ sts.load_delayed (0);
+ l.unlock ();
+ callback (db, obj, callback_event::post_load);
+ return true;
+ }
+
+ bool access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ find_ (statements_type& sts,
+ const id_type* id)
+ {
+ using namespace sqlite;
+
+ id_image_type& i (sts.id_image ());
+ init (i, *id);
+
+ binding& idb (sts.id_image_binding ());
+ if (i.version != sts.id_image_version () || idb.version == 0)
+ {
+ bind (idb.bind, i);
+ sts.id_image_version (i.version);
+ idb.version++;
+ }
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ select_statement& st (sts.find_statement ());
+
+ st.execute ();
+ auto_result ar (st);
+ select_statement::result r (st.fetch ());
+
+ if (r == select_statement::truncated)
+ {
+ if (grow (im, sts.select_image_truncated ()))
+ im.version++;
+
+ if (im.version != sts.select_image_version ())
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ st.refetch ();
+ }
+ }
+
+ return r != select_statement::no_data;
+ }
+
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ load_ (statements_type& sts,
+ object_type& obj,
+ bool reload)
+ {
+ ODB_POTENTIALLY_UNUSED (reload);
+
+ extra_statement_cache_type& esc (sts.extra_statement_cache ());
+
+ // packages
+ //
+ {
+ ::std::vector< ::bdep::package_state >& v =
+ obj.packages;
+
+ packages_traits::load (
+ v,
+ esc.packages);
+ }
+ }
+
+ result< access::object_traits_impl< ::bdep::configuration, id_sqlite >::object_type >
+ access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ query (database& db, const query_base_type& q)
+ {
+ using namespace sqlite;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+
+ statements_type& sts (
+ conn.statement_cache ().find_object<object_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.select_image_binding ());
+
+ if (im.version != sts.select_image_version () ||
+ imb.version == 0)
+ {
+ bind (imb.bind, im, statement_select);
+ sts.select_image_version (im.version);
+ imb.version++;
+ }
+
+ std::string text (query_statement);
+ if (!q.empty ())
+ {
+ text += " ";
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ conn,
+ text,
+ false,
+ true,
+ q.parameters_binding (),
+ imb));
+
+ st->execute ();
+
+ shared_ptr< odb::object_result_impl<object_type> > r (
+ new (shared) sqlite::object_result_impl<object_type> (
+ q, st, sts, 0));
+
+ return result<object_type> (r);
+ }
+
+ unsigned long long access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ erase_query (database& db, const query_base_type& q)
+ {
+ using namespace sqlite;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+
+ std::string text (erase_query_statement);
+ if (!q.empty ())
+ {
+ text += ' ';
+ text += q.clause ();
+ }
+
+ q.init_parameters ();
+ delete_statement st (
+ conn,
+ text,
+ q.parameters_binding ());
+
+ return st.execute ();
+ }
+
+ // configuration_count
+ //
+
+ bool access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::
+ grow (image_type& i,
+ bool* t)
+ {
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (t);
+
+ bool grew (false);
+
+ // result
+ //
+ t[0UL] = false;
+
+ return grew;
+ }
+
+ void access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::
+ bind (sqlite::bind* b,
+ image_type& i)
+ {
+ using namespace sqlite;
+
+ sqlite::statement_kind sk (statement_select);
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ std::size_t n (0);
+
+ // result
+ //
+ b[n].type = sqlite::bind::integer;
+ b[n].buffer = &i.result_value;
+ b[n].is_null = &i.result_null;
+ n++;
+ }
+
+ void access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::
+ init (view_type& o,
+ const image_type& i,
+ database* db)
+ {
+ ODB_POTENTIALLY_UNUSED (o);
+ ODB_POTENTIALLY_UNUSED (i);
+ ODB_POTENTIALLY_UNUSED (db);
+
+ // result
+ //
+ {
+ ::std::size_t& v =
+ o.result;
+
+ sqlite::value_traits<
+ ::std::size_t,
+ sqlite::id_integer >::set_value (
+ v,
+ i.result_value,
+ i.result_null);
+ }
+ }
+
+ access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::query_base_type
+ access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::
+ query_statement (const query_base_type& q)
+ {
+ query_base_type r (
+ "SELECT "
+ "COUNT(*) ");
+
+ r += "FROM \"configuration\"";
+
+ if (!q.empty ())
+ {
+ r += " ";
+ r += q.clause_prefix ();
+ r += q;
+ }
+
+ return r;
+ }
+
+ result< access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::view_type >
+ access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::
+ query (database& db, const query_base_type& q)
+ {
+ using namespace sqlite;
+ using odb::details::shared;
+ using odb::details::shared_ptr;
+
+ sqlite::connection& conn (
+ sqlite::transaction::current ().connection (db));
+ statements_type& sts (
+ conn.statement_cache ().find_view<view_type> ());
+
+ image_type& im (sts.image ());
+ binding& imb (sts.image_binding ());
+
+ if (im.version != sts.image_version () || imb.version == 0)
+ {
+ bind (imb.bind, im);
+ sts.image_version (im.version);
+ imb.version++;
+ }
+
+ const query_base_type& qs (query_statement (q));
+ qs.init_parameters ();
+ shared_ptr<select_statement> st (
+ new (shared) select_statement (
+ conn,
+ qs.clause (),
+ false,
+ true,
+ qs.parameters_binding (),
+ imb));
+
+ st->execute ();
+
+ shared_ptr< odb::view_result_impl<view_type> > r (
+ new (shared) sqlite::view_result_impl<view_type> (
+ qs, st, sts, 0));
+
+ return result<view_type> (r);
+ }
+}
+
+namespace odb
+{
+ static bool
+ create_schema (database& db, unsigned short pass, bool drop)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (pass);
+ ODB_POTENTIALLY_UNUSED (drop);
+
+ if (drop)
+ {
+ switch (pass)
+ {
+ case 1:
+ {
+ return true;
+ }
+ case 2:
+ {
+ db.execute ("DROP TABLE IF EXISTS \"configuration_packages\"");
+ db.execute ("DROP TABLE IF EXISTS \"configuration\"");
+ db.execute ("CREATE TABLE IF NOT EXISTS \"schema_version\" (\n"
+ " \"name\" TEXT NOT NULL PRIMARY KEY,\n"
+ " \"version\" INTEGER NOT NULL,\n"
+ " \"migration\" INTEGER NOT NULL)");
+ db.execute ("DELETE FROM \"schema_version\"\n"
+ " WHERE \"name\" = ''");
+ return false;
+ }
+ }
+ }
+ else
+ {
+ switch (pass)
+ {
+ case 1:
+ {
+ db.execute ("CREATE TABLE \"configuration\" (\n"
+ " \"id\" INTEGER NULL PRIMARY KEY AUTOINCREMENT,\n"
+ " \"name\" TEXT NULL,\n"
+ " \"type\" TEXT NULL,\n"
+ " \"path\" TEXT NULL,\n"
+ " \"relative_path\" TEXT NULL,\n"
+ " \"default\" INTEGER NULL,\n"
+ " \"forward\" INTEGER NULL,\n"
+ " \"auto_sync\" INTEGER NULL)");
+ db.execute ("CREATE UNIQUE INDEX \"configuration_name_i\"\n"
+ " ON \"configuration\" (\"name\")");
+ db.execute ("CREATE UNIQUE INDEX \"configuration_path_i\"\n"
+ " ON \"configuration\" (\"path\")");
+ db.execute ("CREATE TABLE \"configuration_packages\" (\n"
+ " \"object_id\" INTEGER NULL,\n"
+ " \"index\" INTEGER NULL,\n"
+ " \"name\" TEXT NULL COLLATE NOCASE,\n"
+ " CONSTRAINT \"object_id_fk\"\n"
+ " FOREIGN KEY (\"object_id\")\n"
+ " REFERENCES \"configuration\" (\"id\")\n"
+ " ON DELETE CASCADE)");
+ db.execute ("CREATE INDEX \"configuration_packages_object_id_i\"\n"
+ " ON \"configuration_packages\" (\"object_id\")");
+ db.execute ("CREATE INDEX \"configuration_packages_index_i\"\n"
+ " ON \"configuration_packages\" (\"index\")");
+ return true;
+ }
+ case 2:
+ {
+ db.execute ("CREATE TABLE IF NOT EXISTS \"schema_version\" (\n"
+ " \"name\" TEXT NOT NULL PRIMARY KEY,\n"
+ " \"version\" INTEGER NOT NULL,\n"
+ " \"migration\" INTEGER NOT NULL)");
+ db.execute ("INSERT OR IGNORE INTO \"schema_version\" (\n"
+ " \"name\", \"version\", \"migration\")\n"
+ " VALUES ('', 2, 0)");
+ return false;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ static const schema_catalog_create_entry
+ create_schema_entry_ (
+ id_sqlite,
+ "",
+ &create_schema);
+
+ static const schema_catalog_migrate_entry
+ migrate_schema_entry_2_ (
+ id_sqlite,
+ "",
+ 2ULL,
+ 0);
+}
+
+#include <odb/post.hxx>
diff --git a/bdep/project-odb.hxx b/bdep/project-odb.hxx
new file mode 100644
index 0000000..8c33e4e
--- /dev/null
+++ b/bdep/project-odb.hxx
@@ -0,0 +1,636 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+#ifndef BDEP_PROJECT_ODB_HXX
+#define BDEP_PROJECT_ODB_HXX
+
+// Begin prologue.
+//
+#include <bdep/wrapper-traits.hxx>
+#include <bdep/value-traits.hxx>
+//
+// End prologue.
+
+#include <odb/version.hxx>
+
+#if ODB_VERSION != 20478UL
+#error ODB runtime version mismatch
+#endif
+
+#include <odb/pre.hxx>
+
+#include <bdep/project.hxx>
+
+#include <memory>
+#include <cstddef>
+#include <utility>
+
+#include <odb/core.hxx>
+#include <odb/traits.hxx>
+#include <odb/callback.hxx>
+#include <odb/wrapper-traits.hxx>
+#include <odb/pointer-traits.hxx>
+#include <odb/container-traits.hxx>
+#include <odb/session.hxx>
+#include <odb/cache-traits.hxx>
+#include <odb/result.hxx>
+#include <odb/simple-object-result.hxx>
+#include <odb/view-image.hxx>
+#include <odb/view-result.hxx>
+
+#include <odb/details/unused.hxx>
+#include <odb/details/shared-ptr.hxx>
+
+namespace odb
+{
+ // configuration
+ //
+ template <>
+ struct class_traits< ::bdep::configuration >
+ {
+ static const class_kind kind = class_object;
+ };
+
+ template <>
+ class access::object_traits< ::bdep::configuration >
+ {
+ public:
+ typedef ::bdep::configuration object_type;
+ typedef ::std::shared_ptr< ::bdep::configuration > pointer_type;
+ typedef odb::pointer_traits<pointer_type> pointer_traits;
+
+ static const bool polymorphic = false;
+
+ typedef ::bdep::optional_uint64_t id_type;
+
+ static const bool auto_id = true;
+
+ static const bool abstract = false;
+
+ static id_type
+ id (const object_type&);
+
+ typedef
+ odb::pointer_cache_traits<
+ pointer_type,
+ odb::session >
+ pointer_cache_traits;
+
+ typedef
+ odb::reference_cache_traits<
+ object_type,
+ odb::session >
+ reference_cache_traits;
+
+ static void
+ callback (database&, object_type&, callback_event);
+
+ static void
+ callback (database&, const object_type&, callback_event);
+ };
+
+ // configuration_count
+ //
+ template <>
+ struct class_traits< ::bdep::configuration_count >
+ {
+ static const class_kind kind = class_view;
+ };
+
+ template <>
+ class access::view_traits< ::bdep::configuration_count >
+ {
+ public:
+ typedef ::bdep::configuration_count view_type;
+ typedef ::bdep::configuration_count* pointer_type;
+
+ static void
+ callback (database&, view_type&, callback_event);
+ };
+}
+
+#include <odb/details/buffer.hxx>
+
+#include <odb/sqlite/version.hxx>
+#include <odb/sqlite/forward.hxx>
+#include <odb/sqlite/binding.hxx>
+#include <odb/sqlite/sqlite-types.hxx>
+#include <odb/sqlite/query.hxx>
+
+namespace odb
+{
+ // package_state
+ //
+ template <>
+ class access::composite_value_traits< ::bdep::package_state, id_sqlite >
+ {
+ public:
+ typedef ::bdep::package_state value_type;
+
+ struct image_type
+ {
+ // name
+ //
+ details::buffer name_value;
+ std::size_t name_size;
+ bool name_null;
+ };
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (sqlite::bind*,
+ image_type&,
+ sqlite::statement_kind);
+
+ static bool
+ init (image_type&,
+ const value_type&,
+ sqlite::statement_kind);
+
+ static void
+ init (value_type&,
+ const image_type&,
+ database*);
+
+ static bool
+ get_null (const image_type&);
+
+ static void
+ set_null (image_type&,
+ sqlite::statement_kind);
+
+ static const std::size_t column_count = 1UL;
+ };
+
+ // configuration
+ //
+ template <typename A>
+ struct query_columns< ::bdep::configuration, id_sqlite, A >
+ {
+ // id
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ ::odb::optional_uint64_traits::wrapped_type,
+ sqlite::id_integer >::query_type,
+ sqlite::id_integer >
+ id_type_;
+
+ static const id_type_ id;
+
+ // name
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ ::std::basic_string< char >,
+ sqlite::id_text >::query_type,
+ sqlite::id_text >
+ name_type_;
+
+ static const name_type_ name;
+
+ // type
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::query_type,
+ sqlite::id_text >
+ type_type_;
+
+ static const type_type_ type;
+
+ // path
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ ::std::string,
+ sqlite::id_text >::query_type,
+ sqlite::id_text >
+ path_type_;
+
+ static const path_type_ path;
+
+ // relative_path
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ ::std::basic_string< char >,
+ sqlite::id_text >::query_type,
+ sqlite::id_text >
+ relative_path_type_;
+
+ static const relative_path_type_ relative_path;
+
+ // default_
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::query_type,
+ sqlite::id_integer >
+ default__type_;
+
+ static const default__type_ default_;
+
+ // forward
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::query_type,
+ sqlite::id_integer >
+ forward_type_;
+
+ static const forward_type_ forward;
+
+ // auto_sync
+ //
+ typedef
+ sqlite::query_column<
+ sqlite::value_traits<
+ bool,
+ sqlite::id_integer >::query_type,
+ sqlite::id_integer >
+ auto_sync_type_;
+
+ static const auto_sync_type_ auto_sync;
+ };
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::id_type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ id (A::table_name, "\"id\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::name_type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ name (A::table_name, "\"name\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::type_type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ type (A::table_name, "\"type\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::path_type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ path (A::table_name, "\"path\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::relative_path_type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ relative_path (A::table_name, "\"relative_path\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::default__type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ default_ (A::table_name, "\"default\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::forward_type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ forward (A::table_name, "\"forward\"", 0);
+
+ template <typename A>
+ const typename query_columns< ::bdep::configuration, id_sqlite, A >::auto_sync_type_
+ query_columns< ::bdep::configuration, id_sqlite, A >::
+ auto_sync (A::table_name, "\"auto_sync\"", 0);
+
+ template <typename A>
+ struct pointer_query_columns< ::bdep::configuration, id_sqlite, A >:
+ query_columns< ::bdep::configuration, id_sqlite, A >
+ {
+ };
+
+ template <>
+ class access::object_traits_impl< ::bdep::configuration, id_sqlite >:
+ public access::object_traits< ::bdep::configuration >
+ {
+ public:
+ struct id_image_type
+ {
+ long long id_value;
+ bool id_null;
+
+ std::size_t version;
+ };
+
+ struct image_type
+ {
+ // id
+ //
+ long long id_value;
+ bool id_null;
+
+ // name
+ //
+ details::buffer name_value;
+ std::size_t name_size;
+ bool name_null;
+
+ // type
+ //
+ details::buffer type_value;
+ std::size_t type_size;
+ bool type_null;
+
+ // path
+ //
+ details::buffer path_value;
+ std::size_t path_size;
+ bool path_null;
+
+ // relative_path
+ //
+ details::buffer relative_path_value;
+ std::size_t relative_path_size;
+ bool relative_path_null;
+
+ // default_
+ //
+ long long default_value;
+ bool default_null;
+
+ // forward
+ //
+ long long forward_value;
+ bool forward_null;
+
+ // auto_sync
+ //
+ long long auto_sync_value;
+ bool auto_sync_null;
+
+ std::size_t version;
+ };
+
+ struct extra_statement_cache_type;
+
+ // packages
+ //
+ struct packages_traits
+ {
+ static const std::size_t id_column_count = 1UL;
+ static const std::size_t data_column_count = 3UL;
+
+ static const bool versioned = false;
+
+ static const char insert_statement[];
+ static const char select_statement[];
+ static const char delete_statement[];
+
+ typedef ::std::vector< ::bdep::package_state > container_type;
+ typedef
+ odb::access::container_traits<container_type>
+ container_traits_type;
+ typedef container_traits_type::index_type index_type;
+ typedef container_traits_type::value_type value_type;
+
+ typedef ordered_functions<index_type, value_type> functions_type;
+ typedef sqlite::container_statements< packages_traits > statements_type;
+
+ struct data_image_type
+ {
+ // index
+ //
+ long long index_value;
+ bool index_null;
+
+ // value
+ //
+ composite_value_traits< value_type, id_sqlite >::image_type value_value;
+
+ std::size_t version;
+ };
+
+ static void
+ bind (sqlite::bind*,
+ const sqlite::bind* id,
+ std::size_t id_size,
+ data_image_type&);
+
+ static void
+ grow (data_image_type&,
+ bool*);
+
+ static void
+ init (data_image_type&,
+ index_type*,
+ const value_type&);
+
+ static void
+ init (index_type&,
+ value_type&,
+ const data_image_type&,
+ database*);
+
+ static void
+ insert (index_type, const value_type&, void*);
+
+ static bool
+ select (index_type&, value_type&, void*);
+
+ static void
+ delete_ (void*);
+
+ static void
+ persist (const container_type&,
+ statements_type&);
+
+ static void
+ load (container_type&,
+ statements_type&);
+
+ static void
+ update (const container_type&,
+ statements_type&);
+
+ static void
+ erase (statements_type&);
+ };
+
+ using object_traits<object_type>::id;
+
+ static id_type
+ id (const id_image_type&);
+
+ static id_type
+ id (const image_type&);
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (sqlite::bind*,
+ image_type&,
+ sqlite::statement_kind);
+
+ static void
+ bind (sqlite::bind*, id_image_type&);
+
+ static bool
+ init (image_type&,
+ const object_type&,
+ sqlite::statement_kind);
+
+ static void
+ init (object_type&,
+ const image_type&,
+ database*);
+
+ static void
+ init (id_image_type&, const id_type&);
+
+ typedef sqlite::object_statements<object_type> statements_type;
+
+ typedef sqlite::query_base query_base_type;
+
+ static const std::size_t column_count = 8UL;
+ static const std::size_t id_column_count = 1UL;
+ static const std::size_t inverse_column_count = 0UL;
+ static const std::size_t readonly_column_count = 0UL;
+ static const std::size_t managed_optimistic_column_count = 0UL;
+
+ static const std::size_t separate_load_column_count = 0UL;
+ static const std::size_t separate_update_column_count = 0UL;
+
+ static const bool versioned = false;
+
+ static const char persist_statement[];
+ static const char find_statement[];
+ static const char update_statement[];
+ static const char erase_statement[];
+ static const char query_statement[];
+ static const char erase_query_statement[];
+
+ static const char table_name[];
+
+ static void
+ persist (database&, object_type&);
+
+ static pointer_type
+ find (database&, const id_type&);
+
+ static bool
+ find (database&, const id_type&, object_type&);
+
+ static bool
+ reload (database&, object_type&);
+
+ static void
+ update (database&, const object_type&);
+
+ static void
+ erase (database&, const id_type&);
+
+ static void
+ erase (database&, const object_type&);
+
+ static result<object_type>
+ query (database&, const query_base_type&);
+
+ static unsigned long long
+ erase_query (database&, const query_base_type&);
+
+ public:
+ static bool
+ find_ (statements_type&,
+ const id_type*);
+
+ static void
+ load_ (statements_type&,
+ object_type&,
+ bool reload);
+ };
+
+ template <>
+ class access::object_traits_impl< ::bdep::configuration, id_common >:
+ public access::object_traits_impl< ::bdep::configuration, id_sqlite >
+ {
+ };
+
+ // configuration_count
+ //
+ template <>
+ class access::view_traits_impl< ::bdep::configuration_count, id_sqlite >:
+ public access::view_traits< ::bdep::configuration_count >
+ {
+ public:
+ struct image_type
+ {
+ // result
+ //
+ long long result_value;
+ bool result_null;
+
+ std::size_t version;
+ };
+
+ typedef sqlite::view_statements<view_type> statements_type;
+
+ typedef sqlite::query_base query_base_type;
+ struct query_columns;
+
+ static const bool versioned = false;
+
+ static bool
+ grow (image_type&,
+ bool*);
+
+ static void
+ bind (sqlite::bind*,
+ image_type&);
+
+ static void
+ init (view_type&,
+ const image_type&,
+ database*);
+
+ static const std::size_t column_count = 1UL;
+
+ static query_base_type
+ query_statement (const query_base_type&);
+
+ static result<view_type>
+ query (database&, const query_base_type&);
+ };
+
+ template <>
+ class access::view_traits_impl< ::bdep::configuration_count, id_common >:
+ public access::view_traits_impl< ::bdep::configuration_count, id_sqlite >
+ {
+ };
+
+ // configuration
+ //
+ // configuration_count
+ //
+ struct access::view_traits_impl< ::bdep::configuration_count, id_sqlite >::query_columns:
+ odb::pointer_query_columns<
+ ::bdep::configuration,
+ id_sqlite,
+ odb::access::object_traits_impl< ::bdep::configuration, id_sqlite > >
+ {
+ };
+}
+
+#include <bdep/project-odb.ixx>
+
+#include <odb/post.hxx>
+
+#endif // BDEP_PROJECT_ODB_HXX
diff --git a/bdep/project-odb.ixx b/bdep/project-odb.ixx
new file mode 100644
index 0000000..1061753
--- /dev/null
+++ b/bdep/project-odb.ixx
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+//
+// This file was generated by ODB, object-relational mapping (ORM)
+// compiler for C++.
+//
+
+namespace odb
+{
+ // configuration
+ //
+
+ inline
+ access::object_traits< ::bdep::configuration >::id_type
+ access::object_traits< ::bdep::configuration >::
+ id (const object_type& o)
+ {
+ return o.id;
+ }
+
+ inline
+ void access::object_traits< ::bdep::configuration >::
+ callback (database& db, object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ inline
+ void access::object_traits< ::bdep::configuration >::
+ callback (database& db, const object_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+
+ // configuration_count
+ //
+
+ inline
+ void access::view_traits< ::bdep::configuration_count >::
+ callback (database& db, view_type& x, callback_event e)
+ {
+ ODB_POTENTIALLY_UNUSED (db);
+ ODB_POTENTIALLY_UNUSED (x);
+ ODB_POTENTIALLY_UNUSED (e);
+ }
+}
+
+#include <odb/schema-version.hxx>
+
+namespace odb
+{
+ // package_state
+ //
+
+ inline
+ bool access::composite_value_traits< ::bdep::package_state, id_sqlite >::
+ get_null (const image_type& i)
+ {
+ bool r (true);
+ r = r && i.name_null;
+ return r;
+ }
+
+ inline
+ void access::composite_value_traits< ::bdep::package_state, id_sqlite >::
+ set_null (image_type& i,
+ sqlite::statement_kind sk)
+ {
+ ODB_POTENTIALLY_UNUSED (sk);
+
+ using namespace sqlite;
+
+ i.name_null = true;
+ }
+
+ // configuration
+ //
+
+ inline
+ void access::object_traits_impl< ::bdep::configuration, id_sqlite >::
+ erase (database& db, const object_type& obj)
+ {
+ callback (db, obj, callback_event::pre_erase);
+ erase (db, id (obj));
+ callback (db, obj, callback_event::post_erase);
+ }
+
+ // configuration_count
+ //
+}
+
diff --git a/bdep/project-options.cxx b/bdep/project-options.cxx
new file mode 100644
index 0000000..281b321
--- /dev/null
+++ b/bdep/project-options.cxx
@@ -0,0 +1,1619 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // configuration_add_options
+ //
+
+ configuration_add_options::
+ configuration_add_options ()
+ : type_ ("target"),
+ type_specified_ (false),
+ default__ (),
+ no_default_ (),
+ forward_ (),
+ no_forward_ (),
+ auto_sync_ (),
+ no_auto_sync_ (),
+ existing_ (),
+ wipe_ ()
+ {
+ }
+
+ bool configuration_add_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool configuration_add_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool configuration_add_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool configuration_add_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool configuration_add_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void configuration_add_options::
+ merge (const configuration_add_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.type_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->type_, a.type_);
+ this->type_specified_ = true;
+ }
+
+ if (a.default__)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->default__, a.default__);
+ }
+
+ if (a.no_default_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_default_, a.no_default_);
+ }
+
+ if (a.forward_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->forward_, a.forward_);
+ }
+
+ if (a.no_forward_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_forward_, a.no_forward_);
+ }
+
+ if (a.auto_sync_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->auto_sync_, a.auto_sync_);
+ }
+
+ if (a.no_auto_sync_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_auto_sync_, a.no_auto_sync_);
+ }
+
+ if (a.existing_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->existing_, a.existing_);
+ }
+
+ if (a.wipe_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->wipe_, a.wipe_);
+ }
+ }
+
+ ::bdep::cli::usage_para configuration_add_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1m--type\033[0m|\033[1m--config-type\033[0m \033[4mtyp\033[0m The type of the configuration being created. By" << ::std::endl
+ << " default, configuration of type \033[1mtarget\033[0m is created. See" << ::std::endl
+ << " \033[1mbpkg-cfg-create(1)\033[0m for background on configuration" << ::std::endl
+ << " types." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--default\033[0m Make the added or created configuration the default." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-default\033[0m Don't make the first added or created configuration" << ::std::endl
+ << " the default." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--forward\033[0m Make the added or created configuration forwarded." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-forward\033[0m Don't make the added or created configuration" << ::std::endl
+ << " forwarded." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--auto-sync\033[0m Make the added or created configuration automatically" << ::std::endl
+ << " synchronized." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-auto-sync\033[0m Don't make the added or created configuration" << ::std::endl
+ << " automatically synchronized." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--existing\033[0m|\033[1m-e\033[0m Initialize a \033[1mbpkg\033[0m configuration based on an existing" << ::std::endl
+ << " build system configuration." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--wipe\033[0m Wipe the configuration directory clean before" << ::std::endl
+ << " creating the new configuration." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ return p;
+ }
+
+ struct _cli_configuration_add_options_desc_type: ::bdep::cli::options
+ {
+ _cli_configuration_add_options_desc_type ()
+ {
+ ::bdep::configuration_add_options::fill (*this);
+ }
+ };
+
+ void configuration_add_options::
+ fill (::bdep::cli::options& os)
+ {
+ // --type
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("--config-type");
+ std::string dv ("target");
+ ::bdep::cli::option o ("--type", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --default
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--default", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-default
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-default", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --forward
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--forward", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-forward
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-forward", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --auto-sync
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--auto-sync", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-auto-sync
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-auto-sync", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --existing
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-e");
+ std::string dv;
+ ::bdep::cli::option o ("--existing", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --wipe
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--wipe", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& configuration_add_options::
+ description ()
+ {
+ static _cli_configuration_add_options_desc_type _cli_configuration_add_options_desc_;
+ return _cli_configuration_add_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (configuration_add_options&, ::bdep::cli::scanner&)>
+ _cli_configuration_add_options_map;
+
+ static _cli_configuration_add_options_map _cli_configuration_add_options_map_;
+
+ struct _cli_configuration_add_options_map_init
+ {
+ _cli_configuration_add_options_map_init ()
+ {
+ _cli_configuration_add_options_map_["--type"] =
+ &::bdep::cli::thunk< configuration_add_options, string, &configuration_add_options::type_,
+ &configuration_add_options::type_specified_ >;
+ _cli_configuration_add_options_map_["--config-type"] =
+ &::bdep::cli::thunk< configuration_add_options, string, &configuration_add_options::type_,
+ &configuration_add_options::type_specified_ >;
+ _cli_configuration_add_options_map_["--default"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::default__ >;
+ _cli_configuration_add_options_map_["--no-default"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::no_default_ >;
+ _cli_configuration_add_options_map_["--forward"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::forward_ >;
+ _cli_configuration_add_options_map_["--no-forward"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::no_forward_ >;
+ _cli_configuration_add_options_map_["--auto-sync"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::auto_sync_ >;
+ _cli_configuration_add_options_map_["--no-auto-sync"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::no_auto_sync_ >;
+ _cli_configuration_add_options_map_["--existing"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::existing_ >;
+ _cli_configuration_add_options_map_["-e"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::existing_ >;
+ _cli_configuration_add_options_map_["--wipe"] =
+ &::bdep::cli::thunk< configuration_add_options, &configuration_add_options::wipe_ >;
+ }
+ };
+
+ static _cli_configuration_add_options_map_init _cli_configuration_add_options_map_init_;
+
+ bool configuration_add_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_configuration_add_options_map::const_iterator i (_cli_configuration_add_options_map_.find (o));
+
+ if (i != _cli_configuration_add_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool configuration_add_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // configuration_name_options
+ //
+
+ configuration_name_options::
+ configuration_name_options ()
+ : config_name_ (),
+ config_name_specified_ (false),
+ config_id_ (),
+ config_id_specified_ (false)
+ {
+ }
+
+ bool configuration_name_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool configuration_name_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool configuration_name_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool configuration_name_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool configuration_name_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void configuration_name_options::
+ merge (const configuration_name_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // common_options base
+ //
+ ::bdep::common_options::merge (a);
+
+ if (a.config_name_specified_)
+ {
+ ::bdep::cli::parser< vector<pair<string, size_t>>>::merge (
+ this->config_name_, a.config_name_);
+ this->config_name_specified_ = true;
+ }
+
+ if (a.config_id_specified_)
+ {
+ ::bdep::cli::parser< vector<pair<uint64_t, size_t>>>::merge (
+ this->config_id_, a.config_id_);
+ this->config_id_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para configuration_name_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1m--config-name\033[0m|\033[1m-n\033[0m \033[4mname\033[0m Specify the build configuration as a name." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--config-id\033[0m \033[4mnum\033[0m Specify the build configuration as an id." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // common_options base
+ //
+ p = ::bdep::common_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_configuration_name_options_desc_type: ::bdep::cli::options
+ {
+ _cli_configuration_name_options_desc_type ()
+ {
+ ::bdep::configuration_name_options::fill (*this);
+ }
+ };
+
+ void configuration_name_options::
+ fill (::bdep::cli::options& os)
+ {
+ // common_options base
+ //
+ ::bdep::common_options::fill (os);
+
+ // --config-name
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-n");
+ std::string dv;
+ ::bdep::cli::option o ("--config-name", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --config-id
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--config-id", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& configuration_name_options::
+ description ()
+ {
+ static _cli_configuration_name_options_desc_type _cli_configuration_name_options_desc_;
+ return _cli_configuration_name_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (configuration_name_options&, ::bdep::cli::scanner&)>
+ _cli_configuration_name_options_map;
+
+ static _cli_configuration_name_options_map _cli_configuration_name_options_map_;
+
+ struct _cli_configuration_name_options_map_init
+ {
+ _cli_configuration_name_options_map_init ()
+ {
+ _cli_configuration_name_options_map_["--config-name"] =
+ &::bdep::cli::thunk< configuration_name_options, vector<pair<string, size_t>>, &configuration_name_options::config_name_,
+ &configuration_name_options::config_name_specified_ >;
+ _cli_configuration_name_options_map_["-n"] =
+ &::bdep::cli::thunk< configuration_name_options, vector<pair<string, size_t>>, &configuration_name_options::config_name_,
+ &configuration_name_options::config_name_specified_ >;
+ _cli_configuration_name_options_map_["--config-id"] =
+ &::bdep::cli::thunk< configuration_name_options, vector<pair<uint64_t, size_t>>, &configuration_name_options::config_id_,
+ &configuration_name_options::config_id_specified_ >;
+ }
+ };
+
+ static _cli_configuration_name_options_map_init _cli_configuration_name_options_map_init_;
+
+ bool configuration_name_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_configuration_name_options_map::const_iterator i (_cli_configuration_name_options_map_.find (o));
+
+ if (i != _cli_configuration_name_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // common_options base
+ //
+ if (::bdep::common_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool configuration_name_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // project_options
+ //
+
+ project_options::
+ project_options ()
+ : all_ (),
+ config_ (),
+ config_specified_ (false),
+ directory_ (),
+ directory_specified_ (false)
+ {
+ }
+
+ bool project_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool project_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool project_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool project_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool project_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void project_options::
+ merge (const project_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // configuration_name_options base
+ //
+ ::bdep::configuration_name_options::merge (a);
+
+ if (a.all_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->all_, a.all_);
+ }
+
+ if (a.config_specified_)
+ {
+ ::bdep::cli::parser< vector<pair<dir_path, size_t>>>::merge (
+ this->config_, a.config_);
+ this->config_specified_ = true;
+ }
+
+ if (a.directory_specified_)
+ {
+ ::bdep::cli::parser< dir_paths>::merge (
+ this->directory_, a.directory_);
+ this->directory_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para project_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1m--all\033[0m|\033[1m-a\033[0m Use all build configurations." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--config\033[0m|\033[1m-c\033[0m \033[4mdir\033[0m Specify the build configuration as a directory." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mdir\033[0m Assume project/package is in the specified directory" << ::std::endl
+ << " rather than in the current working directory." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // configuration_name_options base
+ //
+ p = ::bdep::configuration_name_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_project_options_desc_type: ::bdep::cli::options
+ {
+ _cli_project_options_desc_type ()
+ {
+ ::bdep::project_options::fill (*this);
+ }
+ };
+
+ void project_options::
+ fill (::bdep::cli::options& os)
+ {
+ // configuration_name_options base
+ //
+ ::bdep::configuration_name_options::fill (os);
+
+ // --all
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-a");
+ std::string dv;
+ ::bdep::cli::option o ("--all", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --config
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-c");
+ std::string dv;
+ ::bdep::cli::option o ("--config", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --directory
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-d");
+ std::string dv;
+ ::bdep::cli::option o ("--directory", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& project_options::
+ description ()
+ {
+ static _cli_project_options_desc_type _cli_project_options_desc_;
+ return _cli_project_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (project_options&, ::bdep::cli::scanner&)>
+ _cli_project_options_map;
+
+ static _cli_project_options_map _cli_project_options_map_;
+
+ struct _cli_project_options_map_init
+ {
+ _cli_project_options_map_init ()
+ {
+ _cli_project_options_map_["--all"] =
+ &::bdep::cli::thunk< project_options, &project_options::all_ >;
+ _cli_project_options_map_["-a"] =
+ &::bdep::cli::thunk< project_options, &project_options::all_ >;
+ _cli_project_options_map_["--config"] =
+ &::bdep::cli::thunk< project_options, vector<pair<dir_path, size_t>>, &project_options::config_,
+ &project_options::config_specified_ >;
+ _cli_project_options_map_["-c"] =
+ &::bdep::cli::thunk< project_options, vector<pair<dir_path, size_t>>, &project_options::config_,
+ &project_options::config_specified_ >;
+ _cli_project_options_map_["--directory"] =
+ &::bdep::cli::thunk< project_options, dir_paths, &project_options::directory_,
+ &project_options::directory_specified_ >;
+ _cli_project_options_map_["-d"] =
+ &::bdep::cli::thunk< project_options, dir_paths, &project_options::directory_,
+ &project_options::directory_specified_ >;
+ }
+ };
+
+ static _cli_project_options_map_init _cli_project_options_map_init_;
+
+ bool project_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_project_options_map::const_iterator i (_cli_project_options_map_.find (o));
+
+ if (i != _cli_project_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // configuration_name_options base
+ //
+ if (::bdep::configuration_name_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool project_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_project_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ p = ::bdep::configuration_add_options::print_usage (os, p);
+
+ p = ::bdep::configuration_name_options::print_usage (os, p);
+
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/project-options.hxx b/bdep/project-options.hxx
new file mode 100644
index 0000000..cca32a1
--- /dev/null
+++ b/bdep/project-options.hxx
@@ -0,0 +1,460 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_PROJECT_OPTIONS_HXX
+#define BDEP_PROJECT_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/common-options.hxx>
+
+namespace bdep
+{
+ class configuration_add_options
+ {
+ public:
+ configuration_add_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const configuration_add_options&);
+
+ // Option accessors and modifiers.
+ //
+ const string&
+ type () const;
+
+ string&
+ type ();
+
+ void
+ type (const string&);
+
+ bool
+ type_specified () const;
+
+ void
+ type_specified (bool);
+
+ const bool&
+ default_ () const;
+
+ bool&
+ default_ ();
+
+ void
+ default_ (const bool&);
+
+ const bool&
+ no_default () const;
+
+ bool&
+ no_default ();
+
+ void
+ no_default (const bool&);
+
+ const bool&
+ forward () const;
+
+ bool&
+ forward ();
+
+ void
+ forward (const bool&);
+
+ const bool&
+ no_forward () const;
+
+ bool&
+ no_forward ();
+
+ void
+ no_forward (const bool&);
+
+ const bool&
+ auto_sync () const;
+
+ bool&
+ auto_sync ();
+
+ void
+ auto_sync (const bool&);
+
+ const bool&
+ no_auto_sync () const;
+
+ bool&
+ no_auto_sync ();
+
+ void
+ no_auto_sync (const bool&);
+
+ const bool&
+ existing () const;
+
+ bool&
+ existing ();
+
+ void
+ existing (const bool&);
+
+ const bool&
+ wipe () const;
+
+ bool&
+ wipe ();
+
+ void
+ wipe (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_configuration_add_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ string type_;
+ bool type_specified_;
+ bool default__;
+ bool no_default_;
+ bool forward_;
+ bool no_forward_;
+ bool auto_sync_;
+ bool no_auto_sync_;
+ bool existing_;
+ bool wipe_;
+ };
+
+ class configuration_name_options: public ::bdep::common_options
+ {
+ public:
+ configuration_name_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const configuration_name_options&);
+
+ // Option accessors and modifiers.
+ //
+ const vector<pair<string, size_t>>&
+ config_name () const;
+
+ vector<pair<string, size_t>>&
+ config_name ();
+
+ void
+ config_name (const vector<pair<string, size_t>>&);
+
+ bool
+ config_name_specified () const;
+
+ void
+ config_name_specified (bool);
+
+ const vector<pair<uint64_t, size_t>>&
+ config_id () const;
+
+ vector<pair<uint64_t, size_t>>&
+ config_id ();
+
+ void
+ config_id (const vector<pair<uint64_t, size_t>>&);
+
+ bool
+ config_id_specified () const;
+
+ void
+ config_id_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_configuration_name_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ vector<pair<string, size_t>> config_name_;
+ bool config_name_specified_;
+ vector<pair<uint64_t, size_t>> config_id_;
+ bool config_id_specified_;
+ };
+
+ class project_options: public ::bdep::configuration_name_options
+ {
+ public:
+ project_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const project_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ all () const;
+
+ bool&
+ all ();
+
+ void
+ all (const bool&);
+
+ const vector<pair<dir_path, size_t>>&
+ config () const;
+
+ vector<pair<dir_path, size_t>>&
+ config ();
+
+ void
+ config (const vector<pair<dir_path, size_t>>&);
+
+ bool
+ config_specified () const;
+
+ void
+ config_specified (bool);
+
+ const dir_paths&
+ directory () const;
+
+ dir_paths&
+ directory ();
+
+ void
+ directory (const dir_paths&);
+
+ bool
+ directory_specified () const;
+
+ void
+ directory_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_project_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool all_;
+ vector<pair<dir_path, size_t>> config_;
+ bool config_specified_;
+ dir_paths directory_;
+ bool directory_specified_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_project_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/project-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_PROJECT_OPTIONS_HXX
diff --git a/bdep/project-options.ixx b/bdep/project-options.ixx
new file mode 100644
index 0000000..77f1310
--- /dev/null
+++ b/bdep/project-options.ixx
@@ -0,0 +1,339 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // configuration_add_options
+ //
+
+ inline const string& configuration_add_options::
+ type () const
+ {
+ return this->type_;
+ }
+
+ inline string& configuration_add_options::
+ type ()
+ {
+ return this->type_;
+ }
+
+ inline void configuration_add_options::
+ type (const string& x)
+ {
+ this->type_ = x;
+ }
+
+ inline bool configuration_add_options::
+ type_specified () const
+ {
+ return this->type_specified_;
+ }
+
+ inline void configuration_add_options::
+ type_specified (bool x)
+ {
+ this->type_specified_ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ default_ () const
+ {
+ return this->default__;
+ }
+
+ inline bool& configuration_add_options::
+ default_ ()
+ {
+ return this->default__;
+ }
+
+ inline void configuration_add_options::
+ default_ (const bool& x)
+ {
+ this->default__ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ no_default () const
+ {
+ return this->no_default_;
+ }
+
+ inline bool& configuration_add_options::
+ no_default ()
+ {
+ return this->no_default_;
+ }
+
+ inline void configuration_add_options::
+ no_default (const bool& x)
+ {
+ this->no_default_ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ forward () const
+ {
+ return this->forward_;
+ }
+
+ inline bool& configuration_add_options::
+ forward ()
+ {
+ return this->forward_;
+ }
+
+ inline void configuration_add_options::
+ forward (const bool& x)
+ {
+ this->forward_ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ no_forward () const
+ {
+ return this->no_forward_;
+ }
+
+ inline bool& configuration_add_options::
+ no_forward ()
+ {
+ return this->no_forward_;
+ }
+
+ inline void configuration_add_options::
+ no_forward (const bool& x)
+ {
+ this->no_forward_ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ auto_sync () const
+ {
+ return this->auto_sync_;
+ }
+
+ inline bool& configuration_add_options::
+ auto_sync ()
+ {
+ return this->auto_sync_;
+ }
+
+ inline void configuration_add_options::
+ auto_sync (const bool& x)
+ {
+ this->auto_sync_ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ no_auto_sync () const
+ {
+ return this->no_auto_sync_;
+ }
+
+ inline bool& configuration_add_options::
+ no_auto_sync ()
+ {
+ return this->no_auto_sync_;
+ }
+
+ inline void configuration_add_options::
+ no_auto_sync (const bool& x)
+ {
+ this->no_auto_sync_ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ existing () const
+ {
+ return this->existing_;
+ }
+
+ inline bool& configuration_add_options::
+ existing ()
+ {
+ return this->existing_;
+ }
+
+ inline void configuration_add_options::
+ existing (const bool& x)
+ {
+ this->existing_ = x;
+ }
+
+ inline const bool& configuration_add_options::
+ wipe () const
+ {
+ return this->wipe_;
+ }
+
+ inline bool& configuration_add_options::
+ wipe ()
+ {
+ return this->wipe_;
+ }
+
+ inline void configuration_add_options::
+ wipe (const bool& x)
+ {
+ this->wipe_ = x;
+ }
+
+ // configuration_name_options
+ //
+
+ inline const vector<pair<string, size_t>>& configuration_name_options::
+ config_name () const
+ {
+ return this->config_name_;
+ }
+
+ inline vector<pair<string, size_t>>& configuration_name_options::
+ config_name ()
+ {
+ return this->config_name_;
+ }
+
+ inline void configuration_name_options::
+ config_name (const vector<pair<string, size_t>>& x)
+ {
+ this->config_name_ = x;
+ }
+
+ inline bool configuration_name_options::
+ config_name_specified () const
+ {
+ return this->config_name_specified_;
+ }
+
+ inline void configuration_name_options::
+ config_name_specified (bool x)
+ {
+ this->config_name_specified_ = x;
+ }
+
+ inline const vector<pair<uint64_t, size_t>>& configuration_name_options::
+ config_id () const
+ {
+ return this->config_id_;
+ }
+
+ inline vector<pair<uint64_t, size_t>>& configuration_name_options::
+ config_id ()
+ {
+ return this->config_id_;
+ }
+
+ inline void configuration_name_options::
+ config_id (const vector<pair<uint64_t, size_t>>& x)
+ {
+ this->config_id_ = x;
+ }
+
+ inline bool configuration_name_options::
+ config_id_specified () const
+ {
+ return this->config_id_specified_;
+ }
+
+ inline void configuration_name_options::
+ config_id_specified (bool x)
+ {
+ this->config_id_specified_ = x;
+ }
+
+ // project_options
+ //
+
+ inline const bool& project_options::
+ all () const
+ {
+ return this->all_;
+ }
+
+ inline bool& project_options::
+ all ()
+ {
+ return this->all_;
+ }
+
+ inline void project_options::
+ all (const bool& x)
+ {
+ this->all_ = x;
+ }
+
+ inline const vector<pair<dir_path, size_t>>& project_options::
+ config () const
+ {
+ return this->config_;
+ }
+
+ inline vector<pair<dir_path, size_t>>& project_options::
+ config ()
+ {
+ return this->config_;
+ }
+
+ inline void project_options::
+ config (const vector<pair<dir_path, size_t>>& x)
+ {
+ this->config_ = x;
+ }
+
+ inline bool project_options::
+ config_specified () const
+ {
+ return this->config_specified_;
+ }
+
+ inline void project_options::
+ config_specified (bool x)
+ {
+ this->config_specified_ = x;
+ }
+
+ inline const dir_paths& project_options::
+ directory () const
+ {
+ return this->directory_;
+ }
+
+ inline dir_paths& project_options::
+ directory ()
+ {
+ return this->directory_;
+ }
+
+ inline void project_options::
+ directory (const dir_paths& x)
+ {
+ this->directory_ = x;
+ }
+
+ inline bool project_options::
+ directory_specified () const
+ {
+ return this->directory_specified_;
+ }
+
+ inline void project_options::
+ directory_specified (bool x)
+ {
+ this->directory_specified_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/projects-configs.cxx b/bdep/projects-configs.cxx
new file mode 100644
index 0000000..b90c37c
--- /dev/null
+++ b/bdep/projects-configs.cxx
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/projects-configs.hxx>
+
+#include <map>
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_projects_configs_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep\033[0m \033[4mcommand\033[0m [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] ...\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "Most \033[1mbdep\033[0m commands operate on a project or some of its packages as well as its" << ::std::endl
+ << "build configurations. For example, \033[1mstatus\033[0m (\033[1mbdep-status(1)\033[0m) shows the status of" << ::std::endl
+ << "one or more project packages in one or more build configurations. While \033[1mfetch\033[0m" << ::std::endl
+ << "(\033[1mbdep-fetch(1)\033[0m) fetches the list of available to the project dependency" << ::std::endl
+ << "packages, again, in one or more build configurations." << ::std::endl
+ << ::std::endl
+ << "Without any \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m options specified, the current working directory is" << ::std::endl
+ << "assumed to be either the project root directory, the package root directory, or" << ::std::endl
+ << "one of the package subdirectories. This is the common \033[1mbdep\033[0m usage mode where you" << ::std::endl
+ << "run it from within your project's source code directories, similar to version" << ::std::endl
+ << "control tools such as \033[1mgit(1)\033[0m." << ::std::endl
+ << ::std::endl
+ << "Alternatively, the project or (several) package directories can be specified" << ::std::endl
+ << "with the \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m options. Additionally, in all the commands except \033[1minit\033[0m," << ::std::endl
+ << "an initialized project package can be specified as a \033[4mpkg\033[0m name. Note that \033[1mbdep\033[0m" << ::std::endl
+ << "operates on a single project but potentially multiple packages belonging to" << ::std::endl
+ << "said project at a time." << ::std::endl
+ << ::std::endl
+ << "Some \033[1mbdep\033[0m commands, such as \033[1mfetch\033[0m, operate on the whole project. If such a" << ::std::endl
+ << "command is given a package directory (either as the working directory or with" << ::std::endl
+ << "\033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m), then it automatically determines its project directory and" << ::std::endl
+ << "uses that." << ::std::endl
+ << ::std::endl
+ << "Other commands, such as \033[1mstatus\033[0m, operate on one or more packages. If such a" << ::std::endl
+ << "command is given a project directory, then it automatically determines the list" << ::std::endl
+ << "of packages belonging to this project and uses that. Note that what exactly" << ::std::endl
+ << "\033[4mbelonging\033[0m means is command-specific. For most commands it means all the" << ::std::endl
+ << "packages initialized in a given build configuration. For \033[1minit\033[0m (\033[1mbdep-init(1)\033[0m)," << ::std::endl
+ << "however, it means all the packages available in the project (for example, as" << ::std::endl
+ << "listed in \033[1mpackages.manifest\033[0m)." << ::std::endl
+ << ::std::endl
+ << "A project managed by \033[1mbdep\033[0m has one or more associated build configurations (see" << ::std::endl
+ << "\033[1mbdep-config(1)\033[0m for details). Some of these configurations, one per the" << ::std::endl
+ << "configuration type, can be designated as default and used if no configuration" << ::std::endl
+ << "is specified explicitly. So, for example, running \033[1mstatus\033[0m without any arguments" << ::std::endl
+ << "in the project directory will show the status of all the project packages" << ::std::endl
+ << "initialized in the default configurations." << ::std::endl
+ << ::std::endl
+ << "An associated build configuration can be assigned a name in which case we can" << ::std::endl
+ << "specify it using the \033[1m@\033[0m\033[4mcfg-name\033[0m\033[0m notation. For example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep status @gcc @clang" << ::std::endl
+ << ::std::endl
+ << "Note to Windows users: a command line argument with leading \033[1m@\033[0m has a special" << ::std::endl
+ << "meaning in PowerShell. To work around this, you can use the alternative \033[1m-@gcc\033[0m" << ::std::endl
+ << "syntax or the \033[1m-n gcc\033[0m option." << ::std::endl
+ << ::std::endl
+ << "A configuration without a name can be specified as a directory using the" << ::std::endl
+ << "\033[1m--config\033[0m|\033[1m-c\033[0m\033[0m option. Name and directory specifications can be mixed. For" << ::std::endl
+ << "example:" << ::std::endl
+ << ::std::endl
+ << "$ bdep status @gcc -c ../builds/clang" << ::std::endl
+ << ::std::endl
+ << "Finally, we can use the \033[1m--all\033[0m|\033[1m-a\033[0m\033[0m option to specify all the build configurations" << ::std::endl
+ << "associated with the project." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/projects-configs.hxx b/bdep/projects-configs.hxx
new file mode 100644
index 0000000..c67d897
--- /dev/null
+++ b/bdep/projects-configs.hxx
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_PROJECTS_CONFIGS_HXX
+#define BDEP_PROJECTS_CONFIGS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/common-options.hxx>
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_projects_configs_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_PROJECTS_CONFIGS_HXX
diff --git a/bdep/publish-options.cxx b/bdep/publish-options.cxx
new file mode 100644
index 0000000..0f720bc
--- /dev/null
+++ b/bdep/publish-options.cxx
@@ -0,0 +1,986 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/publish-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_publish_options
+ //
+
+ cmd_publish_options::
+ cmd_publish_options ()
+ : yes_ (),
+ control_ (),
+ control_specified_ (false),
+ repository_ ("https://cppget.org"),
+ repository_specified_ (false),
+ section_ (),
+ section_specified_ (false),
+ author_name_ (),
+ author_name_specified_ (false),
+ author_email_ (),
+ author_email_specified_ (false),
+ force_ (),
+ force_specified_ (false),
+ simulate_ (),
+ simulate_specified_ (false),
+ forward_ ()
+ {
+ }
+
+ bool cmd_publish_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_publish_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_publish_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_publish_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_publish_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_publish_options::
+ merge (const cmd_publish_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.yes_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->yes_, a.yes_);
+ }
+
+ if (a.control_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->control_, a.control_);
+ this->control_specified_ = true;
+ }
+
+ if (a.repository_specified_)
+ {
+ ::bdep::cli::parser< url>::merge (
+ this->repository_, a.repository_);
+ this->repository_specified_ = true;
+ }
+
+ if (a.section_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->section_, a.section_);
+ this->section_specified_ = true;
+ }
+
+ if (a.author_name_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->author_name_, a.author_name_);
+ this->author_name_specified_ = true;
+ }
+
+ if (a.author_email_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->author_email_, a.author_email_);
+ this->author_email_specified_ = true;
+ }
+
+ if (a.force_specified_)
+ {
+ ::bdep::cli::parser< std::set<string>>::merge (
+ this->force_, a.force_);
+ this->force_specified_ = true;
+ }
+
+ if (a.simulate_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->simulate_, a.simulate_);
+ this->simulate_specified_ = true;
+ }
+
+ if (a.forward_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->forward_, a.forward_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_publish_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mPUBLISH OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--yes\033[0m|\033[1m-y\033[0m Don't prompt for confirmation before publishing." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--control\033[0m \033[4murl\033[0m Control repository URL for the packages being" << ::std::endl
+ << " published." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--repository\033[0m \033[4murl\033[0m Repository to publish the packages to." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--section\033[0m \033[4mname\033[0m Repository section to publish the packages under." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--author-name\033[0m \033[4mname\033[0m Publisher's name. If unspecified, it will be obtained" << ::std::endl
+ << " from the environment and/or version control system." << ::std::endl
+ << " See the ENVIRONMENT section for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--author-email\033[0m \033[4memail\033[0m Publisher's email address. If unspecified, it will be" << ::std::endl
+ << " obtained from the environment and/or version control" << ::std::endl
+ << " system. See the ENVIRONMENT section for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--force\033[0m \033[4mcheck\033[0m Force publishing, disabling the specified check." << ::std::endl
+ << " Repeat this option to disable multiple checks." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--simulate\033[0m \033[4moutcome\033[0m Simulate the specified outcome of the submission" << ::std::endl
+ << " process without actually performing any externally" << ::std::endl
+ << " visible actions (such as publishing the package). The" << ::std::endl
+ << " commonly used outcome value is \033[1msuccess\033[0m. For other" << ::std::endl
+ << " recognized outcomes refer to the submission service" << ::std::endl
+ << " documentation." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--forward\033[0m Use the forwarded configuration for each package" << ::std::endl
+ << " instead of the default configuration." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_publish_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_publish_options_desc_type ()
+ {
+ ::bdep::cmd_publish_options::fill (*this);
+ }
+ };
+
+ void cmd_publish_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --yes
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-y");
+ std::string dv;
+ ::bdep::cli::option o ("--yes", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --control
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--control", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --repository
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("https://cppget.org");
+ ::bdep::cli::option o ("--repository", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --section
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--section", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --author-name
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--author-name", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --author-email
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--author-email", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --force
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--force", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --simulate
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--simulate", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --forward
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--forward", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_publish_options::
+ description ()
+ {
+ static _cli_cmd_publish_options_desc_type _cli_cmd_publish_options_desc_;
+ return _cli_cmd_publish_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_publish_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_publish_options_map;
+
+ static _cli_cmd_publish_options_map _cli_cmd_publish_options_map_;
+
+ struct _cli_cmd_publish_options_map_init
+ {
+ _cli_cmd_publish_options_map_init ()
+ {
+ _cli_cmd_publish_options_map_["--yes"] =
+ &::bdep::cli::thunk< cmd_publish_options, &cmd_publish_options::yes_ >;
+ _cli_cmd_publish_options_map_["-y"] =
+ &::bdep::cli::thunk< cmd_publish_options, &cmd_publish_options::yes_ >;
+ _cli_cmd_publish_options_map_["--control"] =
+ &::bdep::cli::thunk< cmd_publish_options, string, &cmd_publish_options::control_,
+ &cmd_publish_options::control_specified_ >;
+ _cli_cmd_publish_options_map_["--repository"] =
+ &::bdep::cli::thunk< cmd_publish_options, url, &cmd_publish_options::repository_,
+ &cmd_publish_options::repository_specified_ >;
+ _cli_cmd_publish_options_map_["--section"] =
+ &::bdep::cli::thunk< cmd_publish_options, string, &cmd_publish_options::section_,
+ &cmd_publish_options::section_specified_ >;
+ _cli_cmd_publish_options_map_["--author-name"] =
+ &::bdep::cli::thunk< cmd_publish_options, string, &cmd_publish_options::author_name_,
+ &cmd_publish_options::author_name_specified_ >;
+ _cli_cmd_publish_options_map_["--author-email"] =
+ &::bdep::cli::thunk< cmd_publish_options, string, &cmd_publish_options::author_email_,
+ &cmd_publish_options::author_email_specified_ >;
+ _cli_cmd_publish_options_map_["--force"] =
+ &::bdep::cli::thunk< cmd_publish_options, std::set<string>, &cmd_publish_options::force_,
+ &cmd_publish_options::force_specified_ >;
+ _cli_cmd_publish_options_map_["--simulate"] =
+ &::bdep::cli::thunk< cmd_publish_options, string, &cmd_publish_options::simulate_,
+ &cmd_publish_options::simulate_specified_ >;
+ _cli_cmd_publish_options_map_["--forward"] =
+ &::bdep::cli::thunk< cmd_publish_options, &cmd_publish_options::forward_ >;
+ }
+ };
+
+ static _cli_cmd_publish_options_map_init _cli_cmd_publish_options_map_init_;
+
+ bool cmd_publish_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_publish_options_map::const_iterator i (_cli_cmd_publish_options_map_.find (o));
+
+ if (i != _cli_cmd_publish_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_publish_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_publish_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep publish\033[0m [\033[4moptions\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mpkg-spec\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m" << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m | \033[1m--forward\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mpublish\033[0m command publishes the project packages to an archive-based" << ::std::endl
+ << "repository." << ::std::endl
+ << ::std::endl
+ << "Normally, \033[1mpublish\033[0m operates on all the packages in a project. If no project" << ::std::endl
+ << "directory nor package directory/name is specified, then the current working" << ::std::endl
+ << "directory is assumed and all the packages are published, even if the current" << ::std::endl
+ << "directory is a package directory. If, however, one or more packages are" << ::std::endl
+ << "specified explicitly with \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m or as \033[4mpkg\033[0m names, then \033[1mpublish\033[0m assumes" << ::std::endl
+ << "you know what you are doing and only publishes these packages. If no" << ::std::endl
+ << "configuration is specified, then the default configurations are used to prepare" << ::std::endl
+ << "the package distributions. See \033[1mbdep-projects-configs(1)\033[0m for details on" << ::std::endl
+ << "specifying projects and configurations." << ::std::endl
+ << ::std::endl
+ << "For each specified package the \033[1mpublish\033[0m command prepares a package archive and" << ::std::endl
+ << "sends it as part of the package submission request to an archive-based" << ::std::endl
+ << "repository. If the repository is not explicitly specified with the" << ::std::endl
+ << "\033[1m--repository\033[0m option, packages are published to \033[1mcppget.org\033[0m by default." << ::std::endl
+ << ::std::endl
+ << "Along with the package archive, the submission request specifies the repository" << ::std::endl
+ << "section to publish the package under, the control repository URL to use for" << ::std::endl
+ << "authorization, and the publisher's name and email address for the record. While" << ::std::endl
+ << "the exact usage and interpretation of this information depends on the specific" << ::std::endl
+ << "repository, the following semantics apply when submitting to \033[1mcppget.org\033[0m." << ::std::endl
+ << ::std::endl
+ << "The section specifies the desired repository section to publish the project" << ::std::endl
+ << "under. If not explicitly specified with the \033[1m--section\033[0m option, one of the \033[1malpha\033[0m," << ::std::endl
+ << "\033[1mbeta\033[0m, or \033[1mstable\033[0m values are automatically derived from the package version." << ::std::endl
+ << ::std::endl
+ << "The control repository URL is a publicly accessible, read-only URL to a version" << ::std::endl
+ << "control repository (normally the same as the project's) that is used to" << ::std::endl
+ << "authenticate the publisher as someone authorized to publish under this package" << ::std::endl
+ << "name (currently only \033[1mgit(1)\033[0m is supported)." << ::std::endl
+ << ::std::endl
+ << "Prior to sending the submission request, the \033[1mpublish\033[0m command adds the package" << ::std::endl
+ << "archive checksum to the \033[1mbuild2-control\033[0m branch of the project's version control" << ::std::endl
+ << "repository. Upon receiving the submission request, the archive repository" << ::std::endl
+ << "either (1) associates the control repository with the package name if this is" << ::std::endl
+ << "the first time this package name is published or (2) compares the submitted" << ::std::endl
+ << "control repository to the previously associated and, if matching, queries the" << ::std::endl
+ << "\033[1mbuild2-control\033[0m branch to verify that the submitter is authorized to publish" << ::std::endl
+ << "this archive under this package name." << ::std::endl
+ << ::std::endl
+ << "Unless the control repository URL is specified with the \033[1m--control\033[0m option, it" << ::std::endl
+ << "will be automatically derived from the version control's \"remote\" URL. In case" << ::std::endl
+ << "of \033[1mgit(1)\033[0m, it will be based on the \033[1mremote.origin.url\033[0m configuration value unless" << ::std::endl
+ << "overridden with \033[1mremote.origin.build2ControlUrl\033[0m or \033[1mremote.origin.build2Url\033[0m. The" << ::std::endl
+ << "special \033[1mnone\033[0m value to the \033[1m--control\033[0m option can be used to disable this" << ::std::endl
+ << "functionality." << ::std::endl
+ << ::std::endl
+ << "See Package Submission (brep#submit) for details on the submission request" << ::std::endl
+ << "handling by archive repositories." << ::std::endl
+ << ::std::endl
+ << "If the \033[1m--forward\033[0m option is specified then the forwarded configurations are used" << ::std::endl
+ << "to prepare the package distributions. In particular, this means that in this" << ::std::endl
+ << "mode the project doesn't need to be initialized and all that's required is for" << ::std::endl
+ << "package's source directories to be configured to forward to an out of source" << ::std::endl
+ << "build configuration (see \033[1mb(1)\033[0m for details on forwarded configurations). This," << ::std::endl
+ << "for example, can be used to publish packages that don't use the standard" << ::std::endl
+ << "version." << ::std::endl;
+
+ p = ::bdep::cmd_publish_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mpublish\033[0m command the search start directory is the project directory." << ::std::endl
+ << "The following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-publish.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mpublish\033[0m command options cannot be specified in the default" << ::std::endl
+ << "options files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl
+ << ::std::endl
+ << "\033[1mENVIRONMENT\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mBDEP_AUTHOR_NAME\033[0m and \033[1mBDEP_AUTHOR_EMAIL\033[0m environment variables can be used to" << ::std::endl
+ << "specify the publisher's name and email address, respectively. If not set, the" << ::std::endl
+ << "\033[1mpublish\033[0m command will first try to obtain the name and email from the version" << ::std::endl
+ << "control system (if used) and then from the \033[1mUSER\033[0m and \033[1mEMAIL\033[0m environment" << ::std::endl
+ << "variables, respectively. See also the \033[1m--author-name\033[0m and \033[1m--author-email\033[0m options." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/publish-options.hxx b/bdep/publish-options.hxx
new file mode 100644
index 0000000..f456a77
--- /dev/null
+++ b/bdep/publish-options.hxx
@@ -0,0 +1,260 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_PUBLISH_OPTIONS_HXX
+#define BDEP_PUBLISH_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <set>
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_publish_options: public ::bdep::project_options
+ {
+ public:
+ cmd_publish_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_publish_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ yes () const;
+
+ bool&
+ yes ();
+
+ void
+ yes (const bool&);
+
+ const string&
+ control () const;
+
+ string&
+ control ();
+
+ void
+ control (const string&);
+
+ bool
+ control_specified () const;
+
+ void
+ control_specified (bool);
+
+ const url&
+ repository () const;
+
+ url&
+ repository ();
+
+ void
+ repository (const url&);
+
+ bool
+ repository_specified () const;
+
+ void
+ repository_specified (bool);
+
+ const string&
+ section () const;
+
+ string&
+ section ();
+
+ void
+ section (const string&);
+
+ bool
+ section_specified () const;
+
+ void
+ section_specified (bool);
+
+ const string&
+ author_name () const;
+
+ string&
+ author_name ();
+
+ void
+ author_name (const string&);
+
+ bool
+ author_name_specified () const;
+
+ void
+ author_name_specified (bool);
+
+ const string&
+ author_email () const;
+
+ string&
+ author_email ();
+
+ void
+ author_email (const string&);
+
+ bool
+ author_email_specified () const;
+
+ void
+ author_email_specified (bool);
+
+ const std::set<string>&
+ force () const;
+
+ std::set<string>&
+ force ();
+
+ void
+ force (const std::set<string>&);
+
+ bool
+ force_specified () const;
+
+ void
+ force_specified (bool);
+
+ const string&
+ simulate () const;
+
+ string&
+ simulate ();
+
+ void
+ simulate (const string&);
+
+ bool
+ simulate_specified () const;
+
+ void
+ simulate_specified (bool);
+
+ const bool&
+ forward () const;
+
+ bool&
+ forward ();
+
+ void
+ forward (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_publish_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool yes_;
+ string control_;
+ bool control_specified_;
+ url repository_;
+ bool repository_specified_;
+ string section_;
+ bool section_specified_;
+ string author_name_;
+ bool author_name_specified_;
+ string author_email_;
+ bool author_email_specified_;
+ std::set<string> force_;
+ bool force_specified_;
+ string simulate_;
+ bool simulate_specified_;
+ bool forward_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_publish_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/publish-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_PUBLISH_OPTIONS_HXX
diff --git a/bdep/publish-options.ixx b/bdep/publish-options.ixx
new file mode 100644
index 0000000..981bc06
--- /dev/null
+++ b/bdep/publish-options.ixx
@@ -0,0 +1,267 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_publish_options
+ //
+
+ inline const bool& cmd_publish_options::
+ yes () const
+ {
+ return this->yes_;
+ }
+
+ inline bool& cmd_publish_options::
+ yes ()
+ {
+ return this->yes_;
+ }
+
+ inline void cmd_publish_options::
+ yes (const bool& x)
+ {
+ this->yes_ = x;
+ }
+
+ inline const string& cmd_publish_options::
+ control () const
+ {
+ return this->control_;
+ }
+
+ inline string& cmd_publish_options::
+ control ()
+ {
+ return this->control_;
+ }
+
+ inline void cmd_publish_options::
+ control (const string& x)
+ {
+ this->control_ = x;
+ }
+
+ inline bool cmd_publish_options::
+ control_specified () const
+ {
+ return this->control_specified_;
+ }
+
+ inline void cmd_publish_options::
+ control_specified (bool x)
+ {
+ this->control_specified_ = x;
+ }
+
+ inline const url& cmd_publish_options::
+ repository () const
+ {
+ return this->repository_;
+ }
+
+ inline url& cmd_publish_options::
+ repository ()
+ {
+ return this->repository_;
+ }
+
+ inline void cmd_publish_options::
+ repository (const url& x)
+ {
+ this->repository_ = x;
+ }
+
+ inline bool cmd_publish_options::
+ repository_specified () const
+ {
+ return this->repository_specified_;
+ }
+
+ inline void cmd_publish_options::
+ repository_specified (bool x)
+ {
+ this->repository_specified_ = x;
+ }
+
+ inline const string& cmd_publish_options::
+ section () const
+ {
+ return this->section_;
+ }
+
+ inline string& cmd_publish_options::
+ section ()
+ {
+ return this->section_;
+ }
+
+ inline void cmd_publish_options::
+ section (const string& x)
+ {
+ this->section_ = x;
+ }
+
+ inline bool cmd_publish_options::
+ section_specified () const
+ {
+ return this->section_specified_;
+ }
+
+ inline void cmd_publish_options::
+ section_specified (bool x)
+ {
+ this->section_specified_ = x;
+ }
+
+ inline const string& cmd_publish_options::
+ author_name () const
+ {
+ return this->author_name_;
+ }
+
+ inline string& cmd_publish_options::
+ author_name ()
+ {
+ return this->author_name_;
+ }
+
+ inline void cmd_publish_options::
+ author_name (const string& x)
+ {
+ this->author_name_ = x;
+ }
+
+ inline bool cmd_publish_options::
+ author_name_specified () const
+ {
+ return this->author_name_specified_;
+ }
+
+ inline void cmd_publish_options::
+ author_name_specified (bool x)
+ {
+ this->author_name_specified_ = x;
+ }
+
+ inline const string& cmd_publish_options::
+ author_email () const
+ {
+ return this->author_email_;
+ }
+
+ inline string& cmd_publish_options::
+ author_email ()
+ {
+ return this->author_email_;
+ }
+
+ inline void cmd_publish_options::
+ author_email (const string& x)
+ {
+ this->author_email_ = x;
+ }
+
+ inline bool cmd_publish_options::
+ author_email_specified () const
+ {
+ return this->author_email_specified_;
+ }
+
+ inline void cmd_publish_options::
+ author_email_specified (bool x)
+ {
+ this->author_email_specified_ = x;
+ }
+
+ inline const std::set<string>& cmd_publish_options::
+ force () const
+ {
+ return this->force_;
+ }
+
+ inline std::set<string>& cmd_publish_options::
+ force ()
+ {
+ return this->force_;
+ }
+
+ inline void cmd_publish_options::
+ force (const std::set<string>& x)
+ {
+ this->force_ = x;
+ }
+
+ inline bool cmd_publish_options::
+ force_specified () const
+ {
+ return this->force_specified_;
+ }
+
+ inline void cmd_publish_options::
+ force_specified (bool x)
+ {
+ this->force_specified_ = x;
+ }
+
+ inline const string& cmd_publish_options::
+ simulate () const
+ {
+ return this->simulate_;
+ }
+
+ inline string& cmd_publish_options::
+ simulate ()
+ {
+ return this->simulate_;
+ }
+
+ inline void cmd_publish_options::
+ simulate (const string& x)
+ {
+ this->simulate_ = x;
+ }
+
+ inline bool cmd_publish_options::
+ simulate_specified () const
+ {
+ return this->simulate_specified_;
+ }
+
+ inline void cmd_publish_options::
+ simulate_specified (bool x)
+ {
+ this->simulate_specified_ = x;
+ }
+
+ inline const bool& cmd_publish_options::
+ forward () const
+ {
+ return this->forward_;
+ }
+
+ inline bool& cmd_publish_options::
+ forward ()
+ {
+ return this->forward_;
+ }
+
+ inline void cmd_publish_options::
+ forward (const bool& x)
+ {
+ this->forward_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/release-options.cxx b/bdep/release-options.cxx
new file mode 100644
index 0000000..efaba35
--- /dev/null
+++ b/bdep/release-options.cxx
@@ -0,0 +1,1318 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+#include <bdep/release-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/release-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_release_options
+ //
+
+ cmd_release_options::
+ cmd_release_options ()
+ : revision_ (),
+ no_commit_ (),
+ no_tag_ (),
+ tag_ (),
+ current_tag_ (cmd_release_current_tag::keep),
+ current_tag_specified_ (false),
+ push_ (),
+ show_push_ (),
+ no_open_ (),
+ open_ (),
+ amend_ (),
+ squash_ (1),
+ squash_specified_ (false),
+ alpha_ (),
+ beta_ (),
+ minor_ (),
+ major_ (),
+ open_beta_ (),
+ open_patch_ (),
+ open_minor_ (),
+ open_major_ (),
+ open_base_ (),
+ open_base_specified_ (false),
+ edit_ (),
+ no_edit_ (),
+ force_ (),
+ force_specified_ (false),
+ yes_ (),
+ directory_ (),
+ directory_specified_ (false)
+ {
+ }
+
+ bool cmd_release_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_release_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_release_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_release_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_release_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_release_options::
+ merge (const cmd_release_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // common_options base
+ //
+ ::bdep::common_options::merge (a);
+
+ if (a.revision_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->revision_, a.revision_);
+ }
+
+ if (a.no_commit_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_commit_, a.no_commit_);
+ }
+
+ if (a.no_tag_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_tag_, a.no_tag_);
+ }
+
+ if (a.tag_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->tag_, a.tag_);
+ }
+
+ if (a.current_tag_specified_)
+ {
+ ::bdep::cli::parser< cmd_release_current_tag>::merge (
+ this->current_tag_, a.current_tag_);
+ this->current_tag_specified_ = true;
+ }
+
+ if (a.push_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->push_, a.push_);
+ }
+
+ if (a.show_push_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->show_push_, a.show_push_);
+ }
+
+ if (a.no_open_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_open_, a.no_open_);
+ }
+
+ if (a.open_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->open_, a.open_);
+ }
+
+ if (a.amend_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->amend_, a.amend_);
+ }
+
+ if (a.squash_specified_)
+ {
+ ::bdep::cli::parser< size_t>::merge (
+ this->squash_, a.squash_);
+ this->squash_specified_ = true;
+ }
+
+ if (a.alpha_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->alpha_, a.alpha_);
+ }
+
+ if (a.beta_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->beta_, a.beta_);
+ }
+
+ if (a.minor_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->minor_, a.minor_);
+ }
+
+ if (a.major_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->major_, a.major_);
+ }
+
+ if (a.open_beta_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->open_beta_, a.open_beta_);
+ }
+
+ if (a.open_patch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->open_patch_, a.open_patch_);
+ }
+
+ if (a.open_minor_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->open_minor_, a.open_minor_);
+ }
+
+ if (a.open_major_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->open_major_, a.open_major_);
+ }
+
+ if (a.open_base_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->open_base_, a.open_base_);
+ this->open_base_specified_ = true;
+ }
+
+ if (a.edit_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->edit_, a.edit_);
+ }
+
+ if (a.no_edit_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->no_edit_, a.no_edit_);
+ }
+
+ if (a.force_specified_)
+ {
+ ::bdep::cli::parser< std::set<string>>::merge (
+ this->force_, a.force_);
+ this->force_specified_ = true;
+ }
+
+ if (a.yes_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->yes_, a.yes_);
+ }
+
+ if (a.directory_specified_)
+ {
+ ::bdep::cli::parser< dir_paths>::merge (
+ this->directory_, a.directory_);
+ this->directory_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_release_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mRELEASE OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--revision\033[0m Release a new package revision instead of a new" << ::std::endl
+ << " version." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-commit\033[0m Don't commit the changes. Implies \033[1m--no-tag\033[0m and, in" << ::std::endl
+ << " the version release mode, \033[1m--no-open\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-tag\033[0m Don't tag the release commit. Tagging can be" << ::std::endl
+ << " performed later using the \033[1m--tag\033[0m mode option." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--tag\033[0m Tag the already released version instead of releasing" << ::std::endl
+ << " a new one." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--current-tag\033[0m \033[4maction\033[0m Specify what to do with an existing tag for the" << ::std::endl
+ << " current version when tagging a new revision. Valid" << ::std::endl
+ << " values for this option are \033[1mkeep\033[0m (default), \033[1mupdate\033[0m," << ::std::endl
+ << " and \033[1mremove\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--push\033[0m Push the committed changes and tags to the remote." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--show-push\033[0m Print the push command instead of executing it. This" << ::std::endl
+ << " allows examining the committed changes and tags" << ::std::endl
+ << " before pushing them to the remote. Note that the" << ::std::endl
+ << " command is printed to \033[1mstdout\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-open\033[0m Don't open the next development cycle. Opening can be" << ::std::endl
+ << " performed later using the \033[1m--open\033[0m mode option." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--open\033[0m Open the next development cycle instead of releasing" << ::std::endl
+ << " a new version." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--amend\033[0m Release a revision by amending the latest commit" << ::std::endl
+ << " instead of making a new one." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--squash\033[0m \033[4mnum\033[0m Release a revision by squashing the specified number" << ::std::endl
+ << " of previous commits and then amending the result." << ::std::endl
+ << " Requires the \033[1m--amend\033[0m option to be specified." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--alpha\033[0m Release an alpha instead of the final version." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--beta\033[0m Release a beta version instead of the final version." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--minor\033[0m Release the next minor version instead of the current" << ::std::endl
+ << " patch." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--major\033[0m Release the next major version instead of the current" << ::std::endl
+ << " minor or patch." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--open-beta\033[0m Open the development cycle with the next beta" << ::std::endl
+ << " version." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--open-patch\033[0m Open the development cycle with the next patch" << ::std::endl
+ << " version. This is the default if the current patch" << ::std::endl
+ << " version is not 0\033[0m (bugfix release series)." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--open-minor\033[0m Open the development cycle with the next minor" << ::std::endl
+ << " version. This is the default if the current patch" << ::std::endl
+ << " version is 0\033[0m (feature release series)." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--open-major\033[0m Open the development cycle with the next major" << ::std::endl
+ << " version." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--open-base\033[0m \033[4mversion\033[0m Open the development cycle with the specified" << ::std::endl
+ << " version. The base version should be in the" << ::std::endl
+ << " \033[4mmajor\033[0m\033[1m.\033[0m\033[4mminor\033[0m.\033[0m\033[4mpatch\033[0m\033[0m form with the opened version" << ::std::endl
+ << " becoming \033[4mmajor\033[0m\033[1m.\033[0m\033[4mminor\033[0m\033[1m.\033[0m\033[4mpatch\033[0m\033[1m-a.0.z\033[0m\033[0m." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--edit\033[0m Open the commit message for editing." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--no-edit\033[0m Don't open the commit message for editing." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--force\033[0m \033[4mcheck\033[0m Force releasing, disabling the specified check." << ::std::endl
+ << " Repeat this option to disable multiple checks." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--yes\033[0m|\033[1m-y\033[0m Don't prompt for confirmation before releasing." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mdir\033[0m Assume project/package is in the specified directory" << ::std::endl
+ << " rather than in the current working directory." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // common_options base
+ //
+ p = ::bdep::common_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_release_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_release_options_desc_type ()
+ {
+ ::bdep::cmd_release_options::fill (*this);
+ }
+ };
+
+ void cmd_release_options::
+ fill (::bdep::cli::options& os)
+ {
+ // common_options base
+ //
+ ::bdep::common_options::fill (os);
+
+ // --revision
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--revision", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-commit
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-commit", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-tag
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-tag", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --tag
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--tag", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --current-tag
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--current-tag", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --push
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--push", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --show-push
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--show-push", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-open
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-open", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --open
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--open", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --amend
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--amend", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --squash
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("1");
+ ::bdep::cli::option o ("--squash", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --alpha
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--alpha", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --beta
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--beta", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --minor
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--minor", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --major
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--major", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --open-beta
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--open-beta", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --open-patch
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--open-patch", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --open-minor
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--open-minor", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --open-major
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--open-major", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --open-base
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--open-base", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --edit
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--edit", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --no-edit
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--no-edit", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --force
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--force", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --yes
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-y");
+ std::string dv;
+ ::bdep::cli::option o ("--yes", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --directory
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-d");
+ std::string dv;
+ ::bdep::cli::option o ("--directory", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_release_options::
+ description ()
+ {
+ static _cli_cmd_release_options_desc_type _cli_cmd_release_options_desc_;
+ return _cli_cmd_release_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_release_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_release_options_map;
+
+ static _cli_cmd_release_options_map _cli_cmd_release_options_map_;
+
+ struct _cli_cmd_release_options_map_init
+ {
+ _cli_cmd_release_options_map_init ()
+ {
+ _cli_cmd_release_options_map_["--revision"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::revision_ >;
+ _cli_cmd_release_options_map_["--no-commit"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::no_commit_ >;
+ _cli_cmd_release_options_map_["--no-tag"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::no_tag_ >;
+ _cli_cmd_release_options_map_["--tag"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::tag_ >;
+ _cli_cmd_release_options_map_["--current-tag"] =
+ &::bdep::cli::thunk< cmd_release_options, cmd_release_current_tag, &cmd_release_options::current_tag_,
+ &cmd_release_options::current_tag_specified_ >;
+ _cli_cmd_release_options_map_["--push"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::push_ >;
+ _cli_cmd_release_options_map_["--show-push"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::show_push_ >;
+ _cli_cmd_release_options_map_["--no-open"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::no_open_ >;
+ _cli_cmd_release_options_map_["--open"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::open_ >;
+ _cli_cmd_release_options_map_["--amend"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::amend_ >;
+ _cli_cmd_release_options_map_["--squash"] =
+ &::bdep::cli::thunk< cmd_release_options, size_t, &cmd_release_options::squash_,
+ &cmd_release_options::squash_specified_ >;
+ _cli_cmd_release_options_map_["--alpha"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::alpha_ >;
+ _cli_cmd_release_options_map_["--beta"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::beta_ >;
+ _cli_cmd_release_options_map_["--minor"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::minor_ >;
+ _cli_cmd_release_options_map_["--major"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::major_ >;
+ _cli_cmd_release_options_map_["--open-beta"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::open_beta_ >;
+ _cli_cmd_release_options_map_["--open-patch"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::open_patch_ >;
+ _cli_cmd_release_options_map_["--open-minor"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::open_minor_ >;
+ _cli_cmd_release_options_map_["--open-major"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::open_major_ >;
+ _cli_cmd_release_options_map_["--open-base"] =
+ &::bdep::cli::thunk< cmd_release_options, string, &cmd_release_options::open_base_,
+ &cmd_release_options::open_base_specified_ >;
+ _cli_cmd_release_options_map_["--edit"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::edit_ >;
+ _cli_cmd_release_options_map_["--no-edit"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::no_edit_ >;
+ _cli_cmd_release_options_map_["--force"] =
+ &::bdep::cli::thunk< cmd_release_options, std::set<string>, &cmd_release_options::force_,
+ &cmd_release_options::force_specified_ >;
+ _cli_cmd_release_options_map_["--yes"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::yes_ >;
+ _cli_cmd_release_options_map_["-y"] =
+ &::bdep::cli::thunk< cmd_release_options, &cmd_release_options::yes_ >;
+ _cli_cmd_release_options_map_["--directory"] =
+ &::bdep::cli::thunk< cmd_release_options, dir_paths, &cmd_release_options::directory_,
+ &cmd_release_options::directory_specified_ >;
+ _cli_cmd_release_options_map_["-d"] =
+ &::bdep::cli::thunk< cmd_release_options, dir_paths, &cmd_release_options::directory_,
+ &cmd_release_options::directory_specified_ >;
+ }
+ };
+
+ static _cli_cmd_release_options_map_init _cli_cmd_release_options_map_init_;
+
+ bool cmd_release_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_release_options_map::const_iterator i (_cli_cmd_release_options_map_.find (o));
+
+ if (i != _cli_cmd_release_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // common_options base
+ //
+ if (::bdep::common_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_release_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_release_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep release\033[0m [\033[4moptions\033[0m] [\033[4mprj-spec\033[0m]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m | \033[4mpkg-spec\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))...\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mrelease\033[0m command manages the project's version during the release." << ::std::endl
+ << "Specifically, it first changes the snapshot version to the corresponding" << ::std::endl
+ << "release version in each project package's \033[1mmanifest\033[0m file, commits these changes" << ::std::endl
+ << "(unless \033[1m--no-commit\033[0m is specified), tags this commit (unless \033[1m--no-tag\033[0m is" << ::std::endl
+ << "specified), and, if \033[1m--push\033[0m is specified, pushes the changes to the remote." << ::std::endl
+ << "Unless \033[1m--no-open\033[0m is specified, the \033[1mrelease\033[0m command then opens the next" << ::std::endl
+ << "development cycle by changing the version to a snapshot, committing these" << ::std::endl
+ << "changes (unless \033[1m--no-commit\033[0m is specified), and, if \033[1m--push\033[0m is specified, pushing" << ::std::endl
+ << "them to the remote. Note that committing, tagging, and pushing is currently" << ::std::endl
+ << "only supported for \033[1mgit(1)\033[0m project repositories." << ::std::endl
+ << ::std::endl
+ << "The \033[1mrelease\033[0m command can also be used to release a new package revision by" << ::std::endl
+ << "passing the \033[1m--revision\033[0m option. In this mode \033[1mrelease\033[0m increments the current" << ::std::endl
+ << "version's revision component in each project package's \033[1mmanifest\033[0m file, commits" << ::std::endl
+ << "these changes (unless \033[1m--no-commit\033[0m is specified), tags this commit (unless" << ::std::endl
+ << "\033[1m--no-tag\033[0m is specified), and, if \033[1m--push\033[0m is specified, pushes the changes to the" << ::std::endl
+ << "remote. In this mode \033[1mrelease\033[0m can be optionally instructed to update an existing" << ::std::endl
+ << "tag for the current version to point to the latest revision" << ::std::endl
+ << "(\033[1m--current-tag=update\033[0m) or to remove it (\033[1m--current-tag=remove\033[0m)." << ::std::endl
+ << ::std::endl
+ << "When releasing a revision, the project's repository index is expected to" << ::std::endl
+ << "already contain other changes since for a revision all the associated changes," << ::std::endl
+ << "including to version, must belong to a single commit. Alternatively, a revision" << ::std::endl
+ << "can be released by amending one or more existing commits using the \033[1m--amend\033[0m and" << ::std::endl
+ << "\033[1m--squash\033[0m options. In this case the index may still contain additional changes" << ::std::endl
+ << "but is not required to." << ::std::endl
+ << ::std::endl
+ << "The \033[1mrelease\033[0m command also has a number of \033[4mcontinue modes\033[0m that allow the" << ::std::endl
+ << "completion of steps that were previously suppressed with the \033[1m--no-*\033[0m options in" << ::std::endl
+ << "the above main modes. These are \033[1m--tag\033[0m which tags the release commit and, if" << ::std::endl
+ << "\033[1m--push\033[0m is specified, pushes it to the remote as well as \033[1m--open\033[0m which performs" << ::std::endl
+ << "the opening of the next development cycle as described above." << ::std::endl
+ << ::std::endl
+ << "In all the modes that perform a commit, if the project's repository index" << ::std::endl
+ << "already contains other changes, then the commit message is automatically opened" << ::std::endl
+ << "for editing unless \033[1m--no-edit\033[0m is specified. The editing of the commit message in" << ::std::endl
+ << "the absence of other changes can be requested with the \033[1m--edit\033[0m option." << ::std::endl
+ << ::std::endl
+ << "Normally, \033[1mrelease\033[0m operates on all the packages in a project. If no project" << ::std::endl
+ << "directory is specified, then the current working directory is assumed and all" << ::std::endl
+ << "the packages are released, even if the current directory is a package" << ::std::endl
+ << "directory. If, however, one or more package directories are specified" << ::std::endl
+ << "explicitly with \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m, then \033[1mrelease\033[0m assumes you know what you are" << ::std::endl
+ << "doing and only releases these packages. All the packages being released must" << ::std::endl
+ << "have the same version but may have different revisions." << ::std::endl;
+
+ p = ::bdep::cmd_release_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mrelease\033[0m command the search start directory is the project directory." << ::std::endl
+ << "The following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-release.options" << ::std::endl
+ << "bdep-release-{version|revision|open|tag}.options # (mode-dependent)" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mrelease\033[0m command options cannot be specified in the default" << ::std::endl
+ << "options files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl
+ << "--revision" << ::std::endl
+ << "--open" << ::std::endl
+ << "--tag" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/release-options.hxx b/bdep/release-options.hxx
new file mode 100644
index 0000000..0abf9fc
--- /dev/null
+++ b/bdep/release-options.hxx
@@ -0,0 +1,408 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_RELEASE_OPTIONS_HXX
+#define BDEP_RELEASE_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <set>
+
+#include <bdep/common-options.hxx>
+
+#include <bdep/release-types.hxx>
+
+namespace bdep
+{
+ class cmd_release_options: public ::bdep::common_options
+ {
+ public:
+ cmd_release_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_release_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ revision () const;
+
+ bool&
+ revision ();
+
+ void
+ revision (const bool&);
+
+ const bool&
+ no_commit () const;
+
+ bool&
+ no_commit ();
+
+ void
+ no_commit (const bool&);
+
+ const bool&
+ no_tag () const;
+
+ bool&
+ no_tag ();
+
+ void
+ no_tag (const bool&);
+
+ const bool&
+ tag () const;
+
+ bool&
+ tag ();
+
+ void
+ tag (const bool&);
+
+ const cmd_release_current_tag&
+ current_tag () const;
+
+ cmd_release_current_tag&
+ current_tag ();
+
+ void
+ current_tag (const cmd_release_current_tag&);
+
+ bool
+ current_tag_specified () const;
+
+ void
+ current_tag_specified (bool);
+
+ const bool&
+ push () const;
+
+ bool&
+ push ();
+
+ void
+ push (const bool&);
+
+ const bool&
+ show_push () const;
+
+ bool&
+ show_push ();
+
+ void
+ show_push (const bool&);
+
+ const bool&
+ no_open () const;
+
+ bool&
+ no_open ();
+
+ void
+ no_open (const bool&);
+
+ const bool&
+ open () const;
+
+ bool&
+ open ();
+
+ void
+ open (const bool&);
+
+ const bool&
+ amend () const;
+
+ bool&
+ amend ();
+
+ void
+ amend (const bool&);
+
+ const size_t&
+ squash () const;
+
+ size_t&
+ squash ();
+
+ void
+ squash (const size_t&);
+
+ bool
+ squash_specified () const;
+
+ void
+ squash_specified (bool);
+
+ const bool&
+ alpha () const;
+
+ bool&
+ alpha ();
+
+ void
+ alpha (const bool&);
+
+ const bool&
+ beta () const;
+
+ bool&
+ beta ();
+
+ void
+ beta (const bool&);
+
+ const bool&
+ minor () const;
+
+ bool&
+ minor ();
+
+ void
+ minor (const bool&);
+
+ const bool&
+ major () const;
+
+ bool&
+ major ();
+
+ void
+ major (const bool&);
+
+ const bool&
+ open_beta () const;
+
+ bool&
+ open_beta ();
+
+ void
+ open_beta (const bool&);
+
+ const bool&
+ open_patch () const;
+
+ bool&
+ open_patch ();
+
+ void
+ open_patch (const bool&);
+
+ const bool&
+ open_minor () const;
+
+ bool&
+ open_minor ();
+
+ void
+ open_minor (const bool&);
+
+ const bool&
+ open_major () const;
+
+ bool&
+ open_major ();
+
+ void
+ open_major (const bool&);
+
+ const string&
+ open_base () const;
+
+ string&
+ open_base ();
+
+ void
+ open_base (const string&);
+
+ bool
+ open_base_specified () const;
+
+ void
+ open_base_specified (bool);
+
+ const bool&
+ edit () const;
+
+ bool&
+ edit ();
+
+ void
+ edit (const bool&);
+
+ const bool&
+ no_edit () const;
+
+ bool&
+ no_edit ();
+
+ void
+ no_edit (const bool&);
+
+ const std::set<string>&
+ force () const;
+
+ std::set<string>&
+ force ();
+
+ void
+ force (const std::set<string>&);
+
+ bool
+ force_specified () const;
+
+ void
+ force_specified (bool);
+
+ const bool&
+ yes () const;
+
+ bool&
+ yes ();
+
+ void
+ yes (const bool&);
+
+ const dir_paths&
+ directory () const;
+
+ dir_paths&
+ directory ();
+
+ void
+ directory (const dir_paths&);
+
+ bool
+ directory_specified () const;
+
+ void
+ directory_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_release_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool revision_;
+ bool no_commit_;
+ bool no_tag_;
+ bool tag_;
+ cmd_release_current_tag current_tag_;
+ bool current_tag_specified_;
+ bool push_;
+ bool show_push_;
+ bool no_open_;
+ bool open_;
+ bool amend_;
+ size_t squash_;
+ bool squash_specified_;
+ bool alpha_;
+ bool beta_;
+ bool minor_;
+ bool major_;
+ bool open_beta_;
+ bool open_patch_;
+ bool open_minor_;
+ bool open_major_;
+ string open_base_;
+ bool open_base_specified_;
+ bool edit_;
+ bool no_edit_;
+ std::set<string> force_;
+ bool force_specified_;
+ bool yes_;
+ dir_paths directory_;
+ bool directory_specified_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_release_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/release-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_RELEASE_OPTIONS_HXX
diff --git a/bdep/release-options.ixx b/bdep/release-options.ixx
new file mode 100644
index 0000000..8780a92
--- /dev/null
+++ b/bdep/release-options.ixx
@@ -0,0 +1,531 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_release_options
+ //
+
+ inline const bool& cmd_release_options::
+ revision () const
+ {
+ return this->revision_;
+ }
+
+ inline bool& cmd_release_options::
+ revision ()
+ {
+ return this->revision_;
+ }
+
+ inline void cmd_release_options::
+ revision (const bool& x)
+ {
+ this->revision_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ no_commit () const
+ {
+ return this->no_commit_;
+ }
+
+ inline bool& cmd_release_options::
+ no_commit ()
+ {
+ return this->no_commit_;
+ }
+
+ inline void cmd_release_options::
+ no_commit (const bool& x)
+ {
+ this->no_commit_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ no_tag () const
+ {
+ return this->no_tag_;
+ }
+
+ inline bool& cmd_release_options::
+ no_tag ()
+ {
+ return this->no_tag_;
+ }
+
+ inline void cmd_release_options::
+ no_tag (const bool& x)
+ {
+ this->no_tag_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ tag () const
+ {
+ return this->tag_;
+ }
+
+ inline bool& cmd_release_options::
+ tag ()
+ {
+ return this->tag_;
+ }
+
+ inline void cmd_release_options::
+ tag (const bool& x)
+ {
+ this->tag_ = x;
+ }
+
+ inline const cmd_release_current_tag& cmd_release_options::
+ current_tag () const
+ {
+ return this->current_tag_;
+ }
+
+ inline cmd_release_current_tag& cmd_release_options::
+ current_tag ()
+ {
+ return this->current_tag_;
+ }
+
+ inline void cmd_release_options::
+ current_tag (const cmd_release_current_tag& x)
+ {
+ this->current_tag_ = x;
+ }
+
+ inline bool cmd_release_options::
+ current_tag_specified () const
+ {
+ return this->current_tag_specified_;
+ }
+
+ inline void cmd_release_options::
+ current_tag_specified (bool x)
+ {
+ this->current_tag_specified_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ push () const
+ {
+ return this->push_;
+ }
+
+ inline bool& cmd_release_options::
+ push ()
+ {
+ return this->push_;
+ }
+
+ inline void cmd_release_options::
+ push (const bool& x)
+ {
+ this->push_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ show_push () const
+ {
+ return this->show_push_;
+ }
+
+ inline bool& cmd_release_options::
+ show_push ()
+ {
+ return this->show_push_;
+ }
+
+ inline void cmd_release_options::
+ show_push (const bool& x)
+ {
+ this->show_push_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ no_open () const
+ {
+ return this->no_open_;
+ }
+
+ inline bool& cmd_release_options::
+ no_open ()
+ {
+ return this->no_open_;
+ }
+
+ inline void cmd_release_options::
+ no_open (const bool& x)
+ {
+ this->no_open_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ open () const
+ {
+ return this->open_;
+ }
+
+ inline bool& cmd_release_options::
+ open ()
+ {
+ return this->open_;
+ }
+
+ inline void cmd_release_options::
+ open (const bool& x)
+ {
+ this->open_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ amend () const
+ {
+ return this->amend_;
+ }
+
+ inline bool& cmd_release_options::
+ amend ()
+ {
+ return this->amend_;
+ }
+
+ inline void cmd_release_options::
+ amend (const bool& x)
+ {
+ this->amend_ = x;
+ }
+
+ inline const size_t& cmd_release_options::
+ squash () const
+ {
+ return this->squash_;
+ }
+
+ inline size_t& cmd_release_options::
+ squash ()
+ {
+ return this->squash_;
+ }
+
+ inline void cmd_release_options::
+ squash (const size_t& x)
+ {
+ this->squash_ = x;
+ }
+
+ inline bool cmd_release_options::
+ squash_specified () const
+ {
+ return this->squash_specified_;
+ }
+
+ inline void cmd_release_options::
+ squash_specified (bool x)
+ {
+ this->squash_specified_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ alpha () const
+ {
+ return this->alpha_;
+ }
+
+ inline bool& cmd_release_options::
+ alpha ()
+ {
+ return this->alpha_;
+ }
+
+ inline void cmd_release_options::
+ alpha (const bool& x)
+ {
+ this->alpha_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ beta () const
+ {
+ return this->beta_;
+ }
+
+ inline bool& cmd_release_options::
+ beta ()
+ {
+ return this->beta_;
+ }
+
+ inline void cmd_release_options::
+ beta (const bool& x)
+ {
+ this->beta_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ minor () const
+ {
+ return this->minor_;
+ }
+
+ inline bool& cmd_release_options::
+ minor ()
+ {
+ return this->minor_;
+ }
+
+ inline void cmd_release_options::
+ minor (const bool& x)
+ {
+ this->minor_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ major () const
+ {
+ return this->major_;
+ }
+
+ inline bool& cmd_release_options::
+ major ()
+ {
+ return this->major_;
+ }
+
+ inline void cmd_release_options::
+ major (const bool& x)
+ {
+ this->major_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ open_beta () const
+ {
+ return this->open_beta_;
+ }
+
+ inline bool& cmd_release_options::
+ open_beta ()
+ {
+ return this->open_beta_;
+ }
+
+ inline void cmd_release_options::
+ open_beta (const bool& x)
+ {
+ this->open_beta_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ open_patch () const
+ {
+ return this->open_patch_;
+ }
+
+ inline bool& cmd_release_options::
+ open_patch ()
+ {
+ return this->open_patch_;
+ }
+
+ inline void cmd_release_options::
+ open_patch (const bool& x)
+ {
+ this->open_patch_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ open_minor () const
+ {
+ return this->open_minor_;
+ }
+
+ inline bool& cmd_release_options::
+ open_minor ()
+ {
+ return this->open_minor_;
+ }
+
+ inline void cmd_release_options::
+ open_minor (const bool& x)
+ {
+ this->open_minor_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ open_major () const
+ {
+ return this->open_major_;
+ }
+
+ inline bool& cmd_release_options::
+ open_major ()
+ {
+ return this->open_major_;
+ }
+
+ inline void cmd_release_options::
+ open_major (const bool& x)
+ {
+ this->open_major_ = x;
+ }
+
+ inline const string& cmd_release_options::
+ open_base () const
+ {
+ return this->open_base_;
+ }
+
+ inline string& cmd_release_options::
+ open_base ()
+ {
+ return this->open_base_;
+ }
+
+ inline void cmd_release_options::
+ open_base (const string& x)
+ {
+ this->open_base_ = x;
+ }
+
+ inline bool cmd_release_options::
+ open_base_specified () const
+ {
+ return this->open_base_specified_;
+ }
+
+ inline void cmd_release_options::
+ open_base_specified (bool x)
+ {
+ this->open_base_specified_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ edit () const
+ {
+ return this->edit_;
+ }
+
+ inline bool& cmd_release_options::
+ edit ()
+ {
+ return this->edit_;
+ }
+
+ inline void cmd_release_options::
+ edit (const bool& x)
+ {
+ this->edit_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ no_edit () const
+ {
+ return this->no_edit_;
+ }
+
+ inline bool& cmd_release_options::
+ no_edit ()
+ {
+ return this->no_edit_;
+ }
+
+ inline void cmd_release_options::
+ no_edit (const bool& x)
+ {
+ this->no_edit_ = x;
+ }
+
+ inline const std::set<string>& cmd_release_options::
+ force () const
+ {
+ return this->force_;
+ }
+
+ inline std::set<string>& cmd_release_options::
+ force ()
+ {
+ return this->force_;
+ }
+
+ inline void cmd_release_options::
+ force (const std::set<string>& x)
+ {
+ this->force_ = x;
+ }
+
+ inline bool cmd_release_options::
+ force_specified () const
+ {
+ return this->force_specified_;
+ }
+
+ inline void cmd_release_options::
+ force_specified (bool x)
+ {
+ this->force_specified_ = x;
+ }
+
+ inline const bool& cmd_release_options::
+ yes () const
+ {
+ return this->yes_;
+ }
+
+ inline bool& cmd_release_options::
+ yes ()
+ {
+ return this->yes_;
+ }
+
+ inline void cmd_release_options::
+ yes (const bool& x)
+ {
+ this->yes_ = x;
+ }
+
+ inline const dir_paths& cmd_release_options::
+ directory () const
+ {
+ return this->directory_;
+ }
+
+ inline dir_paths& cmd_release_options::
+ directory ()
+ {
+ return this->directory_;
+ }
+
+ inline void cmd_release_options::
+ directory (const dir_paths& x)
+ {
+ this->directory_ = x;
+ }
+
+ inline bool cmd_release_options::
+ directory_specified () const
+ {
+ return this->directory_specified_;
+ }
+
+ inline void cmd_release_options::
+ directory_specified (bool x)
+ {
+ this->directory_specified_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/status-options.cxx b/bdep/status-options.cxx
new file mode 100644
index 0000000..5a3a5ea
--- /dev/null
+++ b/bdep/status-options.cxx
@@ -0,0 +1,904 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/status-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_status_options
+ //
+
+ cmd_status_options::
+ cmd_status_options ()
+ : immediate_ (),
+ recursive_ (),
+ old_available_ (),
+ fetch_ (),
+ fetch_full_ ()
+ {
+ }
+
+ bool cmd_status_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_status_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_status_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_status_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_status_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_status_options::
+ merge (const cmd_status_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.immediate_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->immediate_, a.immediate_);
+ }
+
+ if (a.recursive_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->recursive_, a.recursive_);
+ }
+
+ if (a.old_available_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->old_available_, a.old_available_);
+ }
+
+ if (a.fetch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->fetch_, a.fetch_);
+ }
+
+ if (a.fetch_full_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->fetch_full_, a.fetch_full_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_status_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSTATUS OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--immediate\033[0m|\033[1m-i\033[0m Also print the status of immediate dependencies." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--recursive\033[0m|\033[1m-r\033[0m Also print the status of all dependencies," << ::std::endl
+ << " recursively." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--old-available\033[0m|\033[1m-o\033[0m Print old available versions." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--fetch\033[0m|\033[1m-f\033[0m Perform the \033[1mfetch\033[0m command prior to printing the" << ::std::endl
+ << " status." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--fetch-full\033[0m|\033[1m-F\033[0m Perform the \033[1mfetch --full\033[0m command prior to printing" << ::std::endl
+ << " the status." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_status_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_status_options_desc_type ()
+ {
+ ::bdep::cmd_status_options::fill (*this);
+ }
+ };
+
+ void cmd_status_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --immediate
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-i");
+ std::string dv;
+ ::bdep::cli::option o ("--immediate", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --recursive
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-r");
+ std::string dv;
+ ::bdep::cli::option o ("--recursive", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --old-available
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-o");
+ std::string dv;
+ ::bdep::cli::option o ("--old-available", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --fetch
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-f");
+ std::string dv;
+ ::bdep::cli::option o ("--fetch", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --fetch-full
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-F");
+ std::string dv;
+ ::bdep::cli::option o ("--fetch-full", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_status_options::
+ description ()
+ {
+ static _cli_cmd_status_options_desc_type _cli_cmd_status_options_desc_;
+ return _cli_cmd_status_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_status_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_status_options_map;
+
+ static _cli_cmd_status_options_map _cli_cmd_status_options_map_;
+
+ struct _cli_cmd_status_options_map_init
+ {
+ _cli_cmd_status_options_map_init ()
+ {
+ _cli_cmd_status_options_map_["--immediate"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::immediate_ >;
+ _cli_cmd_status_options_map_["-i"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::immediate_ >;
+ _cli_cmd_status_options_map_["--recursive"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::recursive_ >;
+ _cli_cmd_status_options_map_["-r"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::recursive_ >;
+ _cli_cmd_status_options_map_["--old-available"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::old_available_ >;
+ _cli_cmd_status_options_map_["-o"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::old_available_ >;
+ _cli_cmd_status_options_map_["--fetch"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::fetch_ >;
+ _cli_cmd_status_options_map_["-f"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::fetch_ >;
+ _cli_cmd_status_options_map_["--fetch-full"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::fetch_full_ >;
+ _cli_cmd_status_options_map_["-F"] =
+ &::bdep::cli::thunk< cmd_status_options, &cmd_status_options::fetch_full_ >;
+ }
+ };
+
+ static _cli_cmd_status_options_map_init _cli_cmd_status_options_map_init_;
+
+ bool cmd_status_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_status_options_map::const_iterator i (_cli_cmd_status_options_map_.find (o));
+
+ if (i != _cli_cmd_status_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_status_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_status_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep status\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mdep-spec\033[0m...]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mdep-spec\033[0m = \033[4mpkg\033[0m[\033[1m/\033[0m\033[4mver\033[0m]" << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mstatus\033[0m command prints the status of project packages and/or their" << ::std::endl
+ << "dependencies in one or more build configurations." << ::std::endl
+ << ::std::endl
+ << "If no project or package directory is specified, then the current working" << ::std::endl
+ << "directory is assumed. If no configuration is specified, then the default" << ::std::endl
+ << "configurations are assumed. See \033[1mbdep-projects-configs(1)\033[0m for details on" << ::std::endl
+ << "specifying projects and configurations." << ::std::endl
+ << ::std::endl
+ << "Note that if a package that is specified as a \033[4mpkg\033[0m name (as opposed to as a" << ::std::endl
+ << "directory with \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m) belongs to the project and is initialized in any" << ::std::endl
+ << "of the specified configurations, then it is interpreted as \033[4mpkg-spec\033[0m. Otherwise," << ::std::endl
+ << "it is interpreted as \033[4mdep-spec\033[0m." << ::std::endl
+ << ::std::endl
+ << "If no \033[4mdep-spec\033[0m arguments are specified, then \033[1mstatus\033[0m prints the status of the" << ::std::endl
+ << "project's packages. Otherwise, the status of the specified dependency packages" << ::std::endl
+ << "is printed. Additionally, the status of immediate or all dependencies of the" << ::std::endl
+ << "above packages can be printed by specifying the \033[1m--immediate\033[0m|\033[1m-i\033[0m\033[0m or" << ::std::endl
+ << "\033[1m--recursive\033[0m|\033[1m-r\033[0m\033[0m options, respectively." << ::std::endl
+ << ::std::endl
+ << "In the default output format (see the \033[1m--stdout-format\033[0m common option), the" << ::std::endl
+ << "status of each package is printed on a separate line. Note that the status is" << ::std::endl
+ << "written to \033[1mstdout\033[0m, not \033[1mstderr\033[0m. The semantics of \033[4mdep-spec\033[0m and the format of the" << ::std::endl
+ << "status line are described in \033[1mbpkg-pkg-status(1)\033[0m." << ::std::endl
+ << ::std::endl
+ << "If the output format is \033[1mjson\033[0m, then the output is a JSON array of objects which" << ::std::endl
+ << "are the serialized representation of the following C++ \033[1mstruct\033[0m" << ::std::endl
+ << "\033[1mconfiguration_package_status\033[0m:" << ::std::endl
+ << ::std::endl
+ << "struct configuration" << ::std::endl
+ << "{" << ::std::endl
+ << " uint64_t id;" << ::std::endl
+ << " string path;" << ::std::endl
+ << " optional<string> name;" << ::std::endl
+ << "};" << ::std::endl
+ << ::std::endl
+ << "struct configuration_package_status" << ::std::endl
+ << "{" << ::std::endl
+ << " configuration configuration;" << ::std::endl
+ << " vector<package_status> packages;" << ::std::endl
+ << "};" << ::std::endl
+ << ::std::endl
+ << "For example:" << ::std::endl
+ << ::std::endl
+ << "[" << ::std::endl
+ << " {" << ::std::endl
+ << " \"configuration\": {" << ::std::endl
+ << " \"id\": 1," << ::std::endl
+ << " \"path\": \"/tmp/hello-gcc\"," << ::std::endl
+ << " \"name\": \"gcc\"" << ::std::endl
+ << " }," << ::std::endl
+ << " \"packages\": [" << ::std::endl
+ << " {" << ::std::endl
+ << " \"name\": \"hello\"," << ::std::endl
+ << " \"status\": \"configured\"," << ::std::endl
+ << " \"version\": \"1.0.0\"," << ::std::endl
+ << " \"hold_package\": true," << ::std::endl
+ << " \"available_versions\": [" << ::std::endl
+ << " {" << ::std::endl
+ << " \"version\": \"1.0.1\"" << ::std::endl
+ << " }," << ::std::endl
+ << " {" << ::std::endl
+ << " \"version\": \"2.0.0\"" << ::std::endl
+ << " }" << ::std::endl
+ << " ]," << ::std::endl
+ << " \"dependencies\": [" << ::std::endl
+ << " {" << ::std::endl
+ << " \"name\": \"libhello\"," << ::std::endl
+ << " \"status\": \"configured\"," << ::std::endl
+ << " \"version\": \"1.0.2\"" << ::std::endl
+ << " }" << ::std::endl
+ << " ]" << ::std::endl
+ << " }" << ::std::endl
+ << " ]" << ::std::endl
+ << " }" << ::std::endl
+ << "]" << ::std::endl
+ << ::std::endl
+ << "See the JSON OUTPUT section in \033[1mbdep-common-options(1)\033[0m for details on the" << ::std::endl
+ << "overall properties of this format and the semantics of the \033[1mstruct\033[0m" << ::std::endl
+ << "serialization." << ::std::endl
+ << ::std::endl
+ << "Refer to the \033[1mlist\033[0m subcommand of \033[1mbdep-config(1)\033[0m for details on the \033[1mstruct\033[0m" << ::std::endl
+ << "\033[1mconfiguration\033[0m members. Refer to \033[1mbpkg-pkg-status(1)\033[0m for the definition of" << ::std::endl
+ << "\033[1mstruct\033[0m \033[1mpackage_status\033[0m. Note also that in the \033[1mjson\033[0m output format certain" << ::std::endl
+ << "conditions (no associated configurations, no initialized packages, etc) are not" << ::std::endl
+ << "treated as errors but instead result in valid output. The uninitialized" << ::std::endl
+ << "packages have the special \033[1muninitialized\033[0m \033[1mstatus\033[0m value." << ::std::endl;
+
+ p = ::bdep::cmd_status_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mstatus\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-status.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mstatus\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/status-options.hxx b/bdep/status-options.hxx
new file mode 100644
index 0000000..3e32499
--- /dev/null
+++ b/bdep/status-options.hxx
@@ -0,0 +1,169 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_STATUS_OPTIONS_HXX
+#define BDEP_STATUS_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_status_options: public ::bdep::project_options
+ {
+ public:
+ cmd_status_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_status_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ immediate () const;
+
+ bool&
+ immediate ();
+
+ void
+ immediate (const bool&);
+
+ const bool&
+ recursive () const;
+
+ bool&
+ recursive ();
+
+ void
+ recursive (const bool&);
+
+ const bool&
+ old_available () const;
+
+ bool&
+ old_available ();
+
+ void
+ old_available (const bool&);
+
+ const bool&
+ fetch () const;
+
+ bool&
+ fetch ();
+
+ void
+ fetch (const bool&);
+
+ const bool&
+ fetch_full () const;
+
+ bool&
+ fetch_full ();
+
+ void
+ fetch_full (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_status_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool immediate_;
+ bool recursive_;
+ bool old_available_;
+ bool fetch_;
+ bool fetch_full_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_status_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/status-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_STATUS_OPTIONS_HXX
diff --git a/bdep/status-options.ixx b/bdep/status-options.ixx
new file mode 100644
index 0000000..8fbafb4
--- /dev/null
+++ b/bdep/status-options.ixx
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_status_options
+ //
+
+ inline const bool& cmd_status_options::
+ immediate () const
+ {
+ return this->immediate_;
+ }
+
+ inline bool& cmd_status_options::
+ immediate ()
+ {
+ return this->immediate_;
+ }
+
+ inline void cmd_status_options::
+ immediate (const bool& x)
+ {
+ this->immediate_ = x;
+ }
+
+ inline const bool& cmd_status_options::
+ recursive () const
+ {
+ return this->recursive_;
+ }
+
+ inline bool& cmd_status_options::
+ recursive ()
+ {
+ return this->recursive_;
+ }
+
+ inline void cmd_status_options::
+ recursive (const bool& x)
+ {
+ this->recursive_ = x;
+ }
+
+ inline const bool& cmd_status_options::
+ old_available () const
+ {
+ return this->old_available_;
+ }
+
+ inline bool& cmd_status_options::
+ old_available ()
+ {
+ return this->old_available_;
+ }
+
+ inline void cmd_status_options::
+ old_available (const bool& x)
+ {
+ this->old_available_ = x;
+ }
+
+ inline const bool& cmd_status_options::
+ fetch () const
+ {
+ return this->fetch_;
+ }
+
+ inline bool& cmd_status_options::
+ fetch ()
+ {
+ return this->fetch_;
+ }
+
+ inline void cmd_status_options::
+ fetch (const bool& x)
+ {
+ this->fetch_ = x;
+ }
+
+ inline const bool& cmd_status_options::
+ fetch_full () const
+ {
+ return this->fetch_full_;
+ }
+
+ inline bool& cmd_status_options::
+ fetch_full ()
+ {
+ return this->fetch_full_;
+ }
+
+ inline void cmd_status_options::
+ fetch_full (const bool& x)
+ {
+ this->fetch_full_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/sync-options.cxx b/bdep/sync-options.cxx
new file mode 100644
index 0000000..d5d6ddb
--- /dev/null
+++ b/bdep/sync-options.cxx
@@ -0,0 +1,1631 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/sync-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_sync_options
+ //
+
+ cmd_sync_options::
+ cmd_sync_options ()
+ : upgrade_ (),
+ patch_ (),
+ immediate_ (),
+ recursive_ (),
+ yes_ (),
+ disfigure_ (),
+ fetch_ (),
+ fetch_full_ (),
+ sys_no_query_ (),
+ sys_install_ (),
+ sys_no_fetch_ (),
+ sys_no_stub_ (),
+ sys_yes_ (),
+ sys_sudo_ ("sudo"),
+ sys_sudo_specified_ (false),
+ create_host_config_ (),
+ create_build2_config_ (),
+ implicit_ (),
+ hook_ (0),
+ hook_specified_ (false)
+ {
+ }
+
+ bool cmd_sync_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_sync_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_sync_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_sync_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_sync_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_sync_options::
+ merge (const cmd_sync_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.upgrade_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->upgrade_, a.upgrade_);
+ }
+
+ if (a.patch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->patch_, a.patch_);
+ }
+
+ if (a.immediate_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->immediate_, a.immediate_);
+ }
+
+ if (a.recursive_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->recursive_, a.recursive_);
+ }
+
+ if (a.yes_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->yes_, a.yes_);
+ }
+
+ if (a.disfigure_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->disfigure_, a.disfigure_);
+ }
+
+ if (a.fetch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->fetch_, a.fetch_);
+ }
+
+ if (a.fetch_full_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->fetch_full_, a.fetch_full_);
+ }
+
+ if (a.sys_no_query_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_no_query_, a.sys_no_query_);
+ }
+
+ if (a.sys_install_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_install_, a.sys_install_);
+ }
+
+ if (a.sys_no_fetch_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_no_fetch_, a.sys_no_fetch_);
+ }
+
+ if (a.sys_no_stub_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_no_stub_, a.sys_no_stub_);
+ }
+
+ if (a.sys_yes_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->sys_yes_, a.sys_yes_);
+ }
+
+ if (a.sys_sudo_specified_)
+ {
+ ::bdep::cli::parser< string>::merge (
+ this->sys_sudo_, a.sys_sudo_);
+ this->sys_sudo_specified_ = true;
+ }
+
+ if (a.create_host_config_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->create_host_config_, a.create_host_config_);
+ }
+
+ if (a.create_build2_config_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->create_build2_config_, a.create_build2_config_);
+ }
+
+ if (a.implicit_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->implicit_, a.implicit_);
+ }
+
+ if (a.hook_specified_)
+ {
+ ::bdep::cli::parser< uint16_t>::merge (
+ this->hook_, a.hook_);
+ this->hook_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_sync_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNC OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--upgrade\033[0m|\033[1m-u\033[0m Upgrade dependencies to the latest available version" << ::std::endl
+ << " that satisfies all the constraints." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--patch\033[0m|\033[1m-p\033[0m Upgrade dependencies to the latest available patch" << ::std::endl
+ << " version that satisfies all the constraints." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--immediate\033[0m|\033[1m-i\033[0m Also upgrade or patch immediate dependencies." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--recursive\033[0m|\033[1m-r\033[0m Also upgrade or patch all dependencies, recursively." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--yes\033[0m|\033[1m-y\033[0m Don't prompt for confirmation when up/down-grading" << ::std::endl
+ << " dependencies." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--disfigure\033[0m Disfigure project packages during synchronization" << ::std::endl
+ << " effectively causing their from-scratch" << ::std::endl
+ << " reconfiguration." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--fetch\033[0m|\033[1m-f\033[0m Perform the \033[1mfetch\033[0m command prior to synchronization." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--fetch-full\033[0m|\033[1m-F\033[0m Perform the \033[1mfetch --full\033[0m command prior to" << ::std::endl
+ << " synchronization." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-no-query\033[0m Do not query the system package manager for the" << ::std::endl
+ << " installed versions of packages specified with the" << ::std::endl
+ << " \033[1msys\033[0m scheme. See the corresponding \033[1mbpkg-pkg-build(1)\033[0m" << ::std::endl
+ << " option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-install\033[0m Instruct the system package manager to install" << ::std::endl
+ << " available versions of packages specified with the" << ::std::endl
+ << " \033[1msys\033[0m scheme that are not already installed. See the" << ::std::endl
+ << " corresponding \033[1mbpkg-pkg-build(1)\033[0m option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-no-fetch\033[0m Do not fetch the system package manager metadata" << ::std::endl
+ << " before querying for available versions of packages" << ::std::endl
+ << " specified with the \033[1msys\033[0m scheme. See the corresponding" << ::std::endl
+ << " \033[1mbpkg-pkg-build(1)\033[0m option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-no-stub\033[0m Do no require a stub for packages specified with the" << ::std::endl
+ << " \033[1msys\033[0m scheme. See the corresponding \033[1mbpkg-pkg-build(1)\033[0m" << ::std::endl
+ << " option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-yes\033[0m Assume the answer to the system package manager" << ::std::endl
+ << " prompts is \033[1myes\033[0m. See the corresponding" << ::std::endl
+ << " \033[1mbpkg-pkg-build(1)\033[0m option for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--sys-sudo\033[0m \033[4mprog\033[0m The \033[1msudo\033[0m program to use for system package manager" << ::std::endl
+ << " interactions that normally require administrative" << ::std::endl
+ << " privileges (fetch package metadata, install packages," << ::std::endl
+ << " etc). See the corresponding \033[1mbpkg-pkg-build(1)\033[0m option" << ::std::endl
+ << " for details." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--create-host-config\033[0m Create a configuration for build-time dependencies" << ::std::endl
+ << " without prompt." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--create-build2-config\033[0m Create a configuration for build system module" << ::std::endl
+ << " dependencies without prompt." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--implicit\033[0m Perform implicit synchronization. This mode is" << ::std::endl
+ << " normally used by other tools (for example, a build" << ::std::endl
+ << " system hook) to ensure projects and configurations" << ::std::endl
+ << " are synchronized. To improve performance, especially" << ::std::endl
+ << " for the \"everything is already synchronized\" case," << ::std::endl
+ << " \033[1msync\033[0m executed in this mode assumes that no" << ::std::endl
+ << " configuration flags (see \033[1mbdep-config(1)\033[0m) have changed" << ::std::endl
+ << " since the last explicit synchronization. It also does" << ::std::endl
+ << " not search for a project in the current working" << ::std::endl
+ << " directory -- if any, its directory should be" << ::std::endl
+ << " specified explicitly with \033[1m--config\033[0m|\033[1m-c\033[0m\033[0m." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_sync_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_sync_options_desc_type ()
+ {
+ ::bdep::cmd_sync_options::fill (*this);
+ }
+ };
+
+ void cmd_sync_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --upgrade
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-u");
+ std::string dv;
+ ::bdep::cli::option o ("--upgrade", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --patch
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-p");
+ std::string dv;
+ ::bdep::cli::option o ("--patch", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --immediate
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-i");
+ std::string dv;
+ ::bdep::cli::option o ("--immediate", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --recursive
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-r");
+ std::string dv;
+ ::bdep::cli::option o ("--recursive", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --yes
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-y");
+ std::string dv;
+ ::bdep::cli::option o ("--yes", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --disfigure
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--disfigure", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --fetch
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-f");
+ std::string dv;
+ ::bdep::cli::option o ("--fetch", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --fetch-full
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-F");
+ std::string dv;
+ ::bdep::cli::option o ("--fetch-full", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-no-query
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-no-query", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-install
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-install", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-no-fetch
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-no-fetch", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-no-stub
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-no-stub", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-yes
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--sys-yes", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --sys-sudo
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("sudo");
+ ::bdep::cli::option o ("--sys-sudo", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --create-host-config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--create-host-config", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --create-build2-config
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--create-build2-config", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --implicit
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--implicit", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --hook
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv ("0");
+ ::bdep::cli::option o ("--hook", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_sync_options::
+ description ()
+ {
+ static _cli_cmd_sync_options_desc_type _cli_cmd_sync_options_desc_;
+ return _cli_cmd_sync_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_sync_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_sync_options_map;
+
+ static _cli_cmd_sync_options_map _cli_cmd_sync_options_map_;
+
+ struct _cli_cmd_sync_options_map_init
+ {
+ _cli_cmd_sync_options_map_init ()
+ {
+ _cli_cmd_sync_options_map_["--upgrade"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::upgrade_ >;
+ _cli_cmd_sync_options_map_["-u"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::upgrade_ >;
+ _cli_cmd_sync_options_map_["--patch"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::patch_ >;
+ _cli_cmd_sync_options_map_["-p"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::patch_ >;
+ _cli_cmd_sync_options_map_["--immediate"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::immediate_ >;
+ _cli_cmd_sync_options_map_["-i"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::immediate_ >;
+ _cli_cmd_sync_options_map_["--recursive"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::recursive_ >;
+ _cli_cmd_sync_options_map_["-r"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::recursive_ >;
+ _cli_cmd_sync_options_map_["--yes"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::yes_ >;
+ _cli_cmd_sync_options_map_["-y"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::yes_ >;
+ _cli_cmd_sync_options_map_["--disfigure"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::disfigure_ >;
+ _cli_cmd_sync_options_map_["--fetch"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::fetch_ >;
+ _cli_cmd_sync_options_map_["-f"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::fetch_ >;
+ _cli_cmd_sync_options_map_["--fetch-full"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::fetch_full_ >;
+ _cli_cmd_sync_options_map_["-F"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::fetch_full_ >;
+ _cli_cmd_sync_options_map_["--sys-no-query"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::sys_no_query_ >;
+ _cli_cmd_sync_options_map_["--sys-install"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::sys_install_ >;
+ _cli_cmd_sync_options_map_["--sys-no-fetch"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::sys_no_fetch_ >;
+ _cli_cmd_sync_options_map_["--sys-no-stub"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::sys_no_stub_ >;
+ _cli_cmd_sync_options_map_["--sys-yes"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::sys_yes_ >;
+ _cli_cmd_sync_options_map_["--sys-sudo"] =
+ &::bdep::cli::thunk< cmd_sync_options, string, &cmd_sync_options::sys_sudo_,
+ &cmd_sync_options::sys_sudo_specified_ >;
+ _cli_cmd_sync_options_map_["--create-host-config"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::create_host_config_ >;
+ _cli_cmd_sync_options_map_["--create-build2-config"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::create_build2_config_ >;
+ _cli_cmd_sync_options_map_["--implicit"] =
+ &::bdep::cli::thunk< cmd_sync_options, &cmd_sync_options::implicit_ >;
+ _cli_cmd_sync_options_map_["--hook"] =
+ &::bdep::cli::thunk< cmd_sync_options, uint16_t, &cmd_sync_options::hook_,
+ &cmd_sync_options::hook_specified_ >;
+ }
+ };
+
+ static _cli_cmd_sync_options_map_init _cli_cmd_sync_options_map_init_;
+
+ bool cmd_sync_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_sync_options_map::const_iterator i (_cli_cmd_sync_options_map_.find (o));
+
+ if (i != _cli_cmd_sync_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_sync_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+
+ // cmd_sync_pkg_options
+ //
+
+ cmd_sync_pkg_options::
+ cmd_sync_pkg_options ()
+ : config_name_ (),
+ config_name_specified_ (false),
+ config_id_ (),
+ config_id_specified_ (false),
+ config_ (),
+ config_specified_ (false)
+ {
+ }
+
+ bool cmd_sync_pkg_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_sync_pkg_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_sync_pkg_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_sync_pkg_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_sync_pkg_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_sync_pkg_options::
+ merge (const cmd_sync_pkg_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ if (a.config_name_specified_)
+ {
+ ::bdep::cli::parser< vector<string>>::merge (
+ this->config_name_, a.config_name_);
+ this->config_name_specified_ = true;
+ }
+
+ if (a.config_id_specified_)
+ {
+ ::bdep::cli::parser< vector<uint64_t>>::merge (
+ this->config_id_, a.config_id_);
+ this->config_id_specified_ = true;
+ }
+
+ if (a.config_specified_)
+ {
+ ::bdep::cli::parser< vector<dir_path>>::merge (
+ this->config_, a.config_);
+ this->config_specified_ = true;
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_sync_pkg_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ return p;
+ }
+
+ struct _cli_cmd_sync_pkg_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_sync_pkg_options_desc_type ()
+ {
+ ::bdep::cmd_sync_pkg_options::fill (*this);
+ }
+ };
+
+ void cmd_sync_pkg_options::
+ fill (::bdep::cli::options& os)
+ {
+ // --config-name
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-n");
+ std::string dv;
+ ::bdep::cli::option o ("--config-name", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --config-id
+ //
+ {
+ ::bdep::cli::option_names a;
+ std::string dv;
+ ::bdep::cli::option o ("--config-id", a, false, dv);
+ os.push_back (o);
+ }
+
+ // --config
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-c");
+ std::string dv;
+ ::bdep::cli::option o ("--config", a, false, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_sync_pkg_options::
+ description ()
+ {
+ static _cli_cmd_sync_pkg_options_desc_type _cli_cmd_sync_pkg_options_desc_;
+ return _cli_cmd_sync_pkg_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_sync_pkg_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_sync_pkg_options_map;
+
+ static _cli_cmd_sync_pkg_options_map _cli_cmd_sync_pkg_options_map_;
+
+ struct _cli_cmd_sync_pkg_options_map_init
+ {
+ _cli_cmd_sync_pkg_options_map_init ()
+ {
+ _cli_cmd_sync_pkg_options_map_["--config-name"] =
+ &::bdep::cli::thunk< cmd_sync_pkg_options, vector<string>, &cmd_sync_pkg_options::config_name_,
+ &cmd_sync_pkg_options::config_name_specified_ >;
+ _cli_cmd_sync_pkg_options_map_["-n"] =
+ &::bdep::cli::thunk< cmd_sync_pkg_options, vector<string>, &cmd_sync_pkg_options::config_name_,
+ &cmd_sync_pkg_options::config_name_specified_ >;
+ _cli_cmd_sync_pkg_options_map_["--config-id"] =
+ &::bdep::cli::thunk< cmd_sync_pkg_options, vector<uint64_t>, &cmd_sync_pkg_options::config_id_,
+ &cmd_sync_pkg_options::config_id_specified_ >;
+ _cli_cmd_sync_pkg_options_map_["--config"] =
+ &::bdep::cli::thunk< cmd_sync_pkg_options, vector<dir_path>, &cmd_sync_pkg_options::config_,
+ &cmd_sync_pkg_options::config_specified_ >;
+ _cli_cmd_sync_pkg_options_map_["-c"] =
+ &::bdep::cli::thunk< cmd_sync_pkg_options, vector<dir_path>, &cmd_sync_pkg_options::config_,
+ &cmd_sync_pkg_options::config_specified_ >;
+ }
+ };
+
+ static _cli_cmd_sync_pkg_options_map_init _cli_cmd_sync_pkg_options_map_init_;
+
+ bool cmd_sync_pkg_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_sync_pkg_options_map::const_iterator i (_cli_cmd_sync_pkg_options_map_.find (o));
+
+ if (i != _cli_cmd_sync_pkg_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool cmd_sync_pkg_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_sync_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep sync\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mpkg-args\033[0m]" << ::std::endl
+ << "\033[1mbdep sync\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] \033[1m--upgrade\033[0m|\033[1m-u\033[0m | \033[1m--patch\033[0m|\033[1m-p\033[0m" << ::std::endl
+ << "\033[1mbdep sync\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] [\033[1m--upgrade\033[0m|\033[1m-u\033[0m | \033[1m--patch\033[0m|\033[1m-p\033[0m]" << ::std::endl
+ << " \033[4mdep-spec\033[0m... [\033[4mcfg-var\033[0m...] \033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mdep-spec\033[0m = \033[4mpkg\033[0m[\033[1m/\033[0m\033[4mver\033[0m]" << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m" << ::std::endl
+ << "\033[4mpkg-args\033[0m = (\033[1m?\033[0m\033[4mpkg\033[0m | \033[4mcfg-var\033[0m)...\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1msync\033[0m command synchronizes a project with its build configurations. The" << ::std::endl
+ << "first form (no \033[1m--upgrade\033[0m or \033[1m--patch\033[0m and only \033[4mpkg-args\033[0m arguments, if any, are" << ::std::endl
+ << "specified) upgrades the project packages to the latest version/iteration," << ::std::endl
+ << "adjusts their dependencies according to the latest manifest information, and" << ::std::endl
+ << "updates the lockfile." << ::std::endl
+ << ::std::endl
+ << "If no project or package directory is specified, then the current working" << ::std::endl
+ << "directory is assumed. If no configuration is specified, then the default" << ::std::endl
+ << "configurations are assumed. See \033[1mbdep-projects-configs(1)\033[0m for details on" << ::std::endl
+ << "specifying projects and configurations. Optional \033[4mpkg-args\033[0m are the additional" << ::std::endl
+ << "dependency packages and/or configuration variables to pass to the underlying" << ::std::endl
+ << "\033[1mbpkg-pkg-build(1)\033[0m command." << ::std::endl
+ << ::std::endl
+ << "The second form (no arguments but either \033[1m--upgrade\033[0m or \033[1m--patch\033[0m is specified), in" << ::std::endl
+ << "addition to the first form's functionality, also upgrades or patches immediate" << ::std::endl
+ << "(by default or if \033[1m--immediate\033[0m|\033[1m-i\033[0m\033[0m is specified) or all (if \033[1m--recursive\033[0m|\033[1m-r\033[0m\033[0m is" << ::std::endl
+ << "specified) dependencies of the specified project packages. If no project" << ::std::endl
+ << "packages are specified explicitly, then this form upgrades or patches" << ::std::endl
+ << "dependencies of all the initialized packages in a project." << ::std::endl
+ << ::std::endl
+ << "The third form (one or more \033[4mdep-spec\033[0m arguments are specified), in addition to" << ::std::endl
+ << "the first form's functionality, also upgrades (by default or if \033[1m--upgrade\033[0m is" << ::std::endl
+ << "specified) or patches (if \033[1m--patch\033[0m is specified) the specified dependencies. If" << ::std::endl
+ << "\033[1m--immediate\033[0m|\033[1m-i\033[0m\033[0m or \033[1m--recursive\033[0m|\033[1m-r\033[0m\033[0m is specified, then it also upgrades or patches" << ::std::endl
+ << "the immediate or all dependencies of the specified dependencies, respectively." << ::std::endl
+ << "Alternative to \033[1m--upgrade\033[0m and \033[1m--patch\033[0m, the desired upgrade (or downgrade)" << ::std::endl
+ << "version can be specified explicitly." << ::std::endl
+ << ::std::endl
+ << "Note that if a package that is specified as a \033[4mpkg\033[0m name (as opposed to as a" << ::std::endl
+ << "directory with \033[1m--directory\033[0m|\033[1m-d\033[0m\033[0m) belongs to the project and is initialized in any" << ::std::endl
+ << "of the specified configurations, then it is interpreted as \033[4mpkg-spec\033[0m of the" << ::std::endl
+ << "first or second form. Otherwise, it is interpreted as \033[4mdep-spec\033[0m of the third" << ::std::endl
+ << "from of the command line." << ::std::endl
+ << ::std::endl
+ << "Note also that \033[1m--immediate\033[0m|\033[1m-i\033[0m\033[0m or \033[1m--recursive\033[0m|\033[1m-r\033[0m\033[0m can only be specified with an" << ::std::endl
+ << "explicit \033[1m--upgrade\033[0m or \033[1m--patch\033[0m." << ::std::endl
+ << ::std::endl
+ << "Configuration variables can be specified to only apply to specific packages in" << ::std::endl
+ << "\033[4mpkg-args\033[0m and \033[4mdep-spec\033[0m using the argument grouping mechanism" << ::std::endl
+ << "(\033[1mbdep-argument-grouping(1)\033[0m). Additionally, packages in \033[4mpkg-args\033[0m can be placed" << ::std::endl
+ << "into specific linked configurations by specifying the configuration with one of" << ::std::endl
+ << "the \033[1m--config*\033[0m options (or \033[1m@\033[0m notation) using the same grouping mechanism." << ::std::endl
+ << ::std::endl
+ << "If during synchronization a build-time dependency is encountered and there is" << ::std::endl
+ << "no build configuration of a suitable type associated with the project, then the" << ::std::endl
+ << "user is prompted (unless the respective \033[1m--create-*-config\033[0m option is specified)" << ::std::endl
+ << "to automatically create such a configuration and associate it with the project." << ::std::endl
+ << "See \033[1mbpkg-cfg-create(1)\033[0m for background on configuration types." << ::std::endl
+ << ::std::endl
+ << "\033[1mEXAMPLES\033[0m" << ::std::endl
+ << ::std::endl
+ << "As an example, consider project \033[1mprj\033[0m with two packages, \033[1mfoo\033[0m and \033[1mlibfoo\033[0m:" << ::std::endl
+ << ::std::endl
+ << "prj/" << ::std::endl
+ << "|-- foo/" << ::std::endl
+ << "`-- libfoo/" << ::std::endl
+ << ::std::endl
+ << "Assuming \033[1mfoo\033[0m and \033[1mlibfoo\033[0m have been initialized in the default build" << ::std::endl
+ << "configuration, the following invocations illustrate the common \033[1msync\033[0m use cases" << ::std::endl
+ << "(the current working directory is shown before the shell prompt)." << ::std::endl
+ << ::std::endl
+ << "Synchronize \033[1mfoo\033[0m and \033[1mlibfoo\033[0m with the default configuration:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep sync" << ::std::endl
+ << ::std::endl
+ << "The same (all initialized packages in a project are always synchronized at" << ::std::endl
+ << "once):" << ::std::endl
+ << ::std::endl
+ << "prj/$ cd foo" << ::std::endl
+ << "foo/$ bdep sync" << ::std::endl
+ << ::std::endl
+ << "Add a dependency on \033[1mlibx\033[0m with \033[1msync\033[0m fetching and configuring a suitable version:" << ::std::endl
+ << ::std::endl
+ << "foo/$ edit manifest # Add 'depends: libx ^1.0.0'" << ::std::endl
+ << "foo/$ bdep sync" << ::std::endl
+ << ::std::endl
+ << "Upgrade all the immediate dependencies of \033[1mfoo\033[0m:" << ::std::endl
+ << ::std::endl
+ << "foo/$ bdep sync -u" << ::std::endl
+ << ::std::endl
+ << "Upgrade all the dependencies of all the initialized packages in a project" << ::std::endl
+ << "recursively:" << ::std::endl
+ << ::std::endl
+ << "foo/$ cd ../" << ::std::endl
+ << "prj/$ bdep sync -u -r" << ::std::endl
+ << ::std::endl
+ << "Upgrade \033[1mlibx\033[0m to the latest version:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep sync libx" << ::std::endl
+ << ::std::endl
+ << "Upgrade \033[1mlibx\033[0m and its immediate dependencies to the latest version:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep sync -u -i libx" << ::std::endl
+ << ::std::endl
+ << "Upgrade \033[1mlibx\033[0m to the latest patch version:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep sync -p libx" << ::std::endl
+ << ::std::endl
+ << "Upgrade \033[1mlibx\033[0m and all its dependencies recursively to the latest patch version." << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep sync -p -r libx" << ::std::endl
+ << ::std::endl
+ << "Upgrade \033[1mlibx\033[0m to version \033[1m1.2.3\033[0m." << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep sync libx/1.2.3" << ::std::endl
+ << ::std::endl
+ << "Upgrade \033[1mlibx\033[0m to version \033[1m1.2.3\033[0m and patch all its dependencies, recursively:" << ::std::endl
+ << ::std::endl
+ << "prj/$ bdep sync -p -r libx/1.2.3" << ::std::endl;
+
+ p = ::bdep::cmd_sync_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ p = ::bdep::cmd_sync_pkg_options::print_usage (os, p);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1msync\033[0m command the search start directory is the project directory," << ::std::endl
+ << "except for the implicit mode for which only the predefined directories (system," << ::std::endl
+ << "etc) are searched in. The following options files are searched for in each" << ::std::endl
+ << "directory and, if found, loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-{sync|sync-implicit}.options # (mode-dependent)" << ::std::endl
+ << ::std::endl
+ << "The following \033[1msync\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl
+ << "--implicit" << ::std::endl
+ << "--config|-c" << ::std::endl
+ << ::std::endl
+ << "\033[1mENVIRONMENT\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mBDEP_SYNC\033[0m environment variable can be used to suppress automatic" << ::std::endl
+ << "synchronization on build system invocation. If set, auto-synchronization will" << ::std::endl
+ << "only be performed if the variable's value is \033[1mtrue\033[0m or \033[1m1\033[0m. The ability to suppress" << ::std::endl
+ << "auto-synchronization can be useful when you don't have usable \033[1mbdep\033[0m and/or \033[1mbpkg\033[0m." << ::std::endl
+ << ::std::endl
+ << "To avoid recursive re-synchronization, the \033[1msync\033[0m command also maintains the" << ::std::endl
+ << "\033[1mBDEP_SYNCED_CONFIGS\033[0m environment variable. It contains a space-separated," << ::std::endl
+ << "\033[1m\"\033[0m-quoted list of configuration paths that have been or are being synchronized" << ::std::endl
+ << "by the current \033[1mbdep\033[0m invocation chain. The \033[1msync\033[0m command examines this variable" << ::std::endl
+ << "and silently ignores synchronization requests that have been or are already" << ::std::endl
+ << "being performed." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/sync-options.hxx b/bdep/sync-options.hxx
new file mode 100644
index 0000000..30e0ab9
--- /dev/null
+++ b/bdep/sync-options.hxx
@@ -0,0 +1,447 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_SYNC_OPTIONS_HXX
+#define BDEP_SYNC_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_sync_options: public ::bdep::project_options
+ {
+ public:
+ cmd_sync_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_sync_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ upgrade () const;
+
+ bool&
+ upgrade ();
+
+ void
+ upgrade (const bool&);
+
+ const bool&
+ patch () const;
+
+ bool&
+ patch ();
+
+ void
+ patch (const bool&);
+
+ const bool&
+ immediate () const;
+
+ bool&
+ immediate ();
+
+ void
+ immediate (const bool&);
+
+ const bool&
+ recursive () const;
+
+ bool&
+ recursive ();
+
+ void
+ recursive (const bool&);
+
+ const bool&
+ yes () const;
+
+ bool&
+ yes ();
+
+ void
+ yes (const bool&);
+
+ const bool&
+ disfigure () const;
+
+ bool&
+ disfigure ();
+
+ void
+ disfigure (const bool&);
+
+ const bool&
+ fetch () const;
+
+ bool&
+ fetch ();
+
+ void
+ fetch (const bool&);
+
+ const bool&
+ fetch_full () const;
+
+ bool&
+ fetch_full ();
+
+ void
+ fetch_full (const bool&);
+
+ const bool&
+ sys_no_query () const;
+
+ bool&
+ sys_no_query ();
+
+ void
+ sys_no_query (const bool&);
+
+ const bool&
+ sys_install () const;
+
+ bool&
+ sys_install ();
+
+ void
+ sys_install (const bool&);
+
+ const bool&
+ sys_no_fetch () const;
+
+ bool&
+ sys_no_fetch ();
+
+ void
+ sys_no_fetch (const bool&);
+
+ const bool&
+ sys_no_stub () const;
+
+ bool&
+ sys_no_stub ();
+
+ void
+ sys_no_stub (const bool&);
+
+ const bool&
+ sys_yes () const;
+
+ bool&
+ sys_yes ();
+
+ void
+ sys_yes (const bool&);
+
+ const string&
+ sys_sudo () const;
+
+ string&
+ sys_sudo ();
+
+ void
+ sys_sudo (const string&);
+
+ bool
+ sys_sudo_specified () const;
+
+ void
+ sys_sudo_specified (bool);
+
+ const bool&
+ create_host_config () const;
+
+ bool&
+ create_host_config ();
+
+ void
+ create_host_config (const bool&);
+
+ const bool&
+ create_build2_config () const;
+
+ bool&
+ create_build2_config ();
+
+ void
+ create_build2_config (const bool&);
+
+ const bool&
+ implicit () const;
+
+ bool&
+ implicit ();
+
+ void
+ implicit (const bool&);
+
+ const uint16_t&
+ hook () const;
+
+ uint16_t&
+ hook ();
+
+ void
+ hook (const uint16_t&);
+
+ bool
+ hook_specified () const;
+
+ void
+ hook_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_sync_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool upgrade_;
+ bool patch_;
+ bool immediate_;
+ bool recursive_;
+ bool yes_;
+ bool disfigure_;
+ bool fetch_;
+ bool fetch_full_;
+ bool sys_no_query_;
+ bool sys_install_;
+ bool sys_no_fetch_;
+ bool sys_no_stub_;
+ bool sys_yes_;
+ string sys_sudo_;
+ bool sys_sudo_specified_;
+ bool create_host_config_;
+ bool create_build2_config_;
+ bool implicit_;
+ uint16_t hook_;
+ bool hook_specified_;
+ };
+
+ class cmd_sync_pkg_options
+ {
+ public:
+ cmd_sync_pkg_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_sync_pkg_options&);
+
+ // Option accessors and modifiers.
+ //
+ const vector<string>&
+ config_name () const;
+
+ vector<string>&
+ config_name ();
+
+ void
+ config_name (const vector<string>&);
+
+ bool
+ config_name_specified () const;
+
+ void
+ config_name_specified (bool);
+
+ const vector<uint64_t>&
+ config_id () const;
+
+ vector<uint64_t>&
+ config_id ();
+
+ void
+ config_id (const vector<uint64_t>&);
+
+ bool
+ config_id_specified () const;
+
+ void
+ config_id_specified (bool);
+
+ const vector<dir_path>&
+ config () const;
+
+ vector<dir_path>&
+ config ();
+
+ void
+ config (const vector<dir_path>&);
+
+ bool
+ config_specified () const;
+
+ void
+ config_specified (bool);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_sync_pkg_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ vector<string> config_name_;
+ bool config_name_specified_;
+ vector<uint64_t> config_id_;
+ bool config_id_specified_;
+ vector<dir_path> config_;
+ bool config_specified_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_sync_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/sync-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_SYNC_OPTIONS_HXX
diff --git a/bdep/sync-options.ixx b/bdep/sync-options.ixx
new file mode 100644
index 0000000..f573f17
--- /dev/null
+++ b/bdep/sync-options.ixx
@@ -0,0 +1,462 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_sync_options
+ //
+
+ inline const bool& cmd_sync_options::
+ upgrade () const
+ {
+ return this->upgrade_;
+ }
+
+ inline bool& cmd_sync_options::
+ upgrade ()
+ {
+ return this->upgrade_;
+ }
+
+ inline void cmd_sync_options::
+ upgrade (const bool& x)
+ {
+ this->upgrade_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ patch () const
+ {
+ return this->patch_;
+ }
+
+ inline bool& cmd_sync_options::
+ patch ()
+ {
+ return this->patch_;
+ }
+
+ inline void cmd_sync_options::
+ patch (const bool& x)
+ {
+ this->patch_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ immediate () const
+ {
+ return this->immediate_;
+ }
+
+ inline bool& cmd_sync_options::
+ immediate ()
+ {
+ return this->immediate_;
+ }
+
+ inline void cmd_sync_options::
+ immediate (const bool& x)
+ {
+ this->immediate_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ recursive () const
+ {
+ return this->recursive_;
+ }
+
+ inline bool& cmd_sync_options::
+ recursive ()
+ {
+ return this->recursive_;
+ }
+
+ inline void cmd_sync_options::
+ recursive (const bool& x)
+ {
+ this->recursive_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ yes () const
+ {
+ return this->yes_;
+ }
+
+ inline bool& cmd_sync_options::
+ yes ()
+ {
+ return this->yes_;
+ }
+
+ inline void cmd_sync_options::
+ yes (const bool& x)
+ {
+ this->yes_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ disfigure () const
+ {
+ return this->disfigure_;
+ }
+
+ inline bool& cmd_sync_options::
+ disfigure ()
+ {
+ return this->disfigure_;
+ }
+
+ inline void cmd_sync_options::
+ disfigure (const bool& x)
+ {
+ this->disfigure_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ fetch () const
+ {
+ return this->fetch_;
+ }
+
+ inline bool& cmd_sync_options::
+ fetch ()
+ {
+ return this->fetch_;
+ }
+
+ inline void cmd_sync_options::
+ fetch (const bool& x)
+ {
+ this->fetch_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ fetch_full () const
+ {
+ return this->fetch_full_;
+ }
+
+ inline bool& cmd_sync_options::
+ fetch_full ()
+ {
+ return this->fetch_full_;
+ }
+
+ inline void cmd_sync_options::
+ fetch_full (const bool& x)
+ {
+ this->fetch_full_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ sys_no_query () const
+ {
+ return this->sys_no_query_;
+ }
+
+ inline bool& cmd_sync_options::
+ sys_no_query ()
+ {
+ return this->sys_no_query_;
+ }
+
+ inline void cmd_sync_options::
+ sys_no_query (const bool& x)
+ {
+ this->sys_no_query_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ sys_install () const
+ {
+ return this->sys_install_;
+ }
+
+ inline bool& cmd_sync_options::
+ sys_install ()
+ {
+ return this->sys_install_;
+ }
+
+ inline void cmd_sync_options::
+ sys_install (const bool& x)
+ {
+ this->sys_install_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ sys_no_fetch () const
+ {
+ return this->sys_no_fetch_;
+ }
+
+ inline bool& cmd_sync_options::
+ sys_no_fetch ()
+ {
+ return this->sys_no_fetch_;
+ }
+
+ inline void cmd_sync_options::
+ sys_no_fetch (const bool& x)
+ {
+ this->sys_no_fetch_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ sys_no_stub () const
+ {
+ return this->sys_no_stub_;
+ }
+
+ inline bool& cmd_sync_options::
+ sys_no_stub ()
+ {
+ return this->sys_no_stub_;
+ }
+
+ inline void cmd_sync_options::
+ sys_no_stub (const bool& x)
+ {
+ this->sys_no_stub_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ sys_yes () const
+ {
+ return this->sys_yes_;
+ }
+
+ inline bool& cmd_sync_options::
+ sys_yes ()
+ {
+ return this->sys_yes_;
+ }
+
+ inline void cmd_sync_options::
+ sys_yes (const bool& x)
+ {
+ this->sys_yes_ = x;
+ }
+
+ inline const string& cmd_sync_options::
+ sys_sudo () const
+ {
+ return this->sys_sudo_;
+ }
+
+ inline string& cmd_sync_options::
+ sys_sudo ()
+ {
+ return this->sys_sudo_;
+ }
+
+ inline void cmd_sync_options::
+ sys_sudo (const string& x)
+ {
+ this->sys_sudo_ = x;
+ }
+
+ inline bool cmd_sync_options::
+ sys_sudo_specified () const
+ {
+ return this->sys_sudo_specified_;
+ }
+
+ inline void cmd_sync_options::
+ sys_sudo_specified (bool x)
+ {
+ this->sys_sudo_specified_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ create_host_config () const
+ {
+ return this->create_host_config_;
+ }
+
+ inline bool& cmd_sync_options::
+ create_host_config ()
+ {
+ return this->create_host_config_;
+ }
+
+ inline void cmd_sync_options::
+ create_host_config (const bool& x)
+ {
+ this->create_host_config_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ create_build2_config () const
+ {
+ return this->create_build2_config_;
+ }
+
+ inline bool& cmd_sync_options::
+ create_build2_config ()
+ {
+ return this->create_build2_config_;
+ }
+
+ inline void cmd_sync_options::
+ create_build2_config (const bool& x)
+ {
+ this->create_build2_config_ = x;
+ }
+
+ inline const bool& cmd_sync_options::
+ implicit () const
+ {
+ return this->implicit_;
+ }
+
+ inline bool& cmd_sync_options::
+ implicit ()
+ {
+ return this->implicit_;
+ }
+
+ inline void cmd_sync_options::
+ implicit (const bool& x)
+ {
+ this->implicit_ = x;
+ }
+
+ inline const uint16_t& cmd_sync_options::
+ hook () const
+ {
+ return this->hook_;
+ }
+
+ inline uint16_t& cmd_sync_options::
+ hook ()
+ {
+ return this->hook_;
+ }
+
+ inline void cmd_sync_options::
+ hook (const uint16_t& x)
+ {
+ this->hook_ = x;
+ }
+
+ inline bool cmd_sync_options::
+ hook_specified () const
+ {
+ return this->hook_specified_;
+ }
+
+ inline void cmd_sync_options::
+ hook_specified (bool x)
+ {
+ this->hook_specified_ = x;
+ }
+
+ // cmd_sync_pkg_options
+ //
+
+ inline const vector<string>& cmd_sync_pkg_options::
+ config_name () const
+ {
+ return this->config_name_;
+ }
+
+ inline vector<string>& cmd_sync_pkg_options::
+ config_name ()
+ {
+ return this->config_name_;
+ }
+
+ inline void cmd_sync_pkg_options::
+ config_name (const vector<string>& x)
+ {
+ this->config_name_ = x;
+ }
+
+ inline bool cmd_sync_pkg_options::
+ config_name_specified () const
+ {
+ return this->config_name_specified_;
+ }
+
+ inline void cmd_sync_pkg_options::
+ config_name_specified (bool x)
+ {
+ this->config_name_specified_ = x;
+ }
+
+ inline const vector<uint64_t>& cmd_sync_pkg_options::
+ config_id () const
+ {
+ return this->config_id_;
+ }
+
+ inline vector<uint64_t>& cmd_sync_pkg_options::
+ config_id ()
+ {
+ return this->config_id_;
+ }
+
+ inline void cmd_sync_pkg_options::
+ config_id (const vector<uint64_t>& x)
+ {
+ this->config_id_ = x;
+ }
+
+ inline bool cmd_sync_pkg_options::
+ config_id_specified () const
+ {
+ return this->config_id_specified_;
+ }
+
+ inline void cmd_sync_pkg_options::
+ config_id_specified (bool x)
+ {
+ this->config_id_specified_ = x;
+ }
+
+ inline const vector<dir_path>& cmd_sync_pkg_options::
+ config () const
+ {
+ return this->config_;
+ }
+
+ inline vector<dir_path>& cmd_sync_pkg_options::
+ config ()
+ {
+ return this->config_;
+ }
+
+ inline void cmd_sync_pkg_options::
+ config (const vector<dir_path>& x)
+ {
+ this->config_ = x;
+ }
+
+ inline bool cmd_sync_pkg_options::
+ config_specified () const
+ {
+ return this->config_specified_;
+ }
+
+ inline void cmd_sync_pkg_options::
+ config_specified (bool x)
+ {
+ this->config_specified_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/test-options.cxx b/bdep/test-options.cxx
new file mode 100644
index 0000000..02cc2bd
--- /dev/null
+++ b/bdep/test-options.cxx
@@ -0,0 +1,758 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/test-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_test_options
+ //
+
+ cmd_test_options::
+ cmd_test_options ()
+ : immediate_ (),
+ recursive_ ()
+ {
+ }
+
+ bool cmd_test_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_test_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_test_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_test_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_test_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_test_options::
+ merge (const cmd_test_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.immediate_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->immediate_, a.immediate_);
+ }
+
+ if (a.recursive_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->recursive_, a.recursive_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_test_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mTEST OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--immediate\033[0m|\033[1m-i\033[0m Also test immediate dependencies." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--recursive\033[0m|\033[1m-r\033[0m Also test all dependencies, recursively." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_test_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_test_options_desc_type ()
+ {
+ ::bdep::cmd_test_options::fill (*this);
+ }
+ };
+
+ void cmd_test_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --immediate
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-i");
+ std::string dv;
+ ::bdep::cli::option o ("--immediate", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --recursive
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-r");
+ std::string dv;
+ ::bdep::cli::option o ("--recursive", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_test_options::
+ description ()
+ {
+ static _cli_cmd_test_options_desc_type _cli_cmd_test_options_desc_;
+ return _cli_cmd_test_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_test_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_test_options_map;
+
+ static _cli_cmd_test_options_map _cli_cmd_test_options_map_;
+
+ struct _cli_cmd_test_options_map_init
+ {
+ _cli_cmd_test_options_map_init ()
+ {
+ _cli_cmd_test_options_map_["--immediate"] =
+ &::bdep::cli::thunk< cmd_test_options, &cmd_test_options::immediate_ >;
+ _cli_cmd_test_options_map_["-i"] =
+ &::bdep::cli::thunk< cmd_test_options, &cmd_test_options::immediate_ >;
+ _cli_cmd_test_options_map_["--recursive"] =
+ &::bdep::cli::thunk< cmd_test_options, &cmd_test_options::recursive_ >;
+ _cli_cmd_test_options_map_["-r"] =
+ &::bdep::cli::thunk< cmd_test_options, &cmd_test_options::recursive_ >;
+ }
+ };
+
+ static _cli_cmd_test_options_map_init _cli_cmd_test_options_map_init_;
+
+ bool cmd_test_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_test_options_map::const_iterator i (_cli_cmd_test_options_map_.find (o));
+
+ if (i != _cli_cmd_test_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_test_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_test_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep test\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mcfg-var\033[0m...]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mtest\033[0m command tests the project packages in one or more build" << ::std::endl
+ << "configurations. Additionally, immediate or all dependencies of the project" << ::std::endl
+ << "packages can be tested by specifying the \033[1m--immediate\033[0m|\033[1m-i\033[0m\033[0m or \033[1m--recursive\033[0m|\033[1m-r\033[0m\033[0m" << ::std::endl
+ << "options, respectively." << ::std::endl
+ << ::std::endl
+ << "Underneath \033[1mtest\033[0m executes the \033[1mbpkg-pkg-test(1)\033[0m command which itself is not much" << ::std::endl
+ << "more than the build system \033[1mtest\033[0m operation (see \033[1mb(1)\033[0m for details). As a result," << ::std::endl
+ << "the main utility of this command is the ability to refer to build" << ::std::endl
+ << "configurations by names and to project packages implicitly via the current" << ::std::endl
+ << "working directory as well as to test dependencies." << ::std::endl
+ << ::std::endl
+ << "If no project or package directory is specified, then the current working" << ::std::endl
+ << "directory is assumed. If no configuration is specified, then the default" << ::std::endl
+ << "configurations are assumed. See \033[1mbdep-projects-configs(1)\033[0m for details on" << ::std::endl
+ << "specifying projects and configurations. Optional \033[4mcfg-var\033[0m...\033[0m are the additional" << ::std::endl
+ << "configuration variables to pass to the build system." << ::std::endl;
+
+ p = ::bdep::cmd_test_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mtest\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-test.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mtest\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/test-options.hxx b/bdep/test-options.hxx
new file mode 100644
index 0000000..a3c107c
--- /dev/null
+++ b/bdep/test-options.hxx
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_TEST_OPTIONS_HXX
+#define BDEP_TEST_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_test_options: public ::bdep::project_options
+ {
+ public:
+ cmd_test_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_test_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ immediate () const;
+
+ bool&
+ immediate ();
+
+ void
+ immediate (const bool&);
+
+ const bool&
+ recursive () const;
+
+ bool&
+ recursive ();
+
+ void
+ recursive (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_test_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool immediate_;
+ bool recursive_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_test_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/test-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_TEST_OPTIONS_HXX
diff --git a/bdep/test-options.ixx b/bdep/test-options.ixx
new file mode 100644
index 0000000..da62249
--- /dev/null
+++ b/bdep/test-options.ixx
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_test_options
+ //
+
+ inline const bool& cmd_test_options::
+ immediate () const
+ {
+ return this->immediate_;
+ }
+
+ inline bool& cmd_test_options::
+ immediate ()
+ {
+ return this->immediate_;
+ }
+
+ inline void cmd_test_options::
+ immediate (const bool& x)
+ {
+ this->immediate_ = x;
+ }
+
+ inline const bool& cmd_test_options::
+ recursive () const
+ {
+ return this->recursive_;
+ }
+
+ inline bool& cmd_test_options::
+ recursive ()
+ {
+ return this->recursive_;
+ }
+
+ inline void cmd_test_options::
+ recursive (const bool& x)
+ {
+ this->recursive_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/bdep/update-options.cxx b/bdep/update-options.cxx
new file mode 100644
index 0000000..70b2570
--- /dev/null
+++ b/bdep/update-options.cxx
@@ -0,0 +1,758 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+#include <bdep/types-parsers.hxx>
+//
+// End prologue.
+
+#include <bdep/update-options.hxx>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <utility>
+#include <ostream>
+#include <sstream>
+#include <cstring>
+
+namespace bdep
+{
+ namespace cli
+ {
+ template <typename X>
+ struct parser
+ {
+ static void
+ parse (X& x, bool& xs, scanner& s)
+ {
+ using namespace std;
+
+ const char* o (s.next ());
+ if (s.more ())
+ {
+ string v (s.next ());
+ istringstream is (v);
+ if (!(is >> x && is.peek () == istringstream::traits_type::eof ()))
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (X& b, const X& a)
+ {
+ b = a;
+ }
+ };
+
+ template <>
+ struct parser<bool>
+ {
+ static void
+ parse (bool& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ const char* v (s.next ());
+
+ if (std::strcmp (v, "1") == 0 ||
+ std::strcmp (v, "true") == 0 ||
+ std::strcmp (v, "TRUE") == 0 ||
+ std::strcmp (v, "True") == 0)
+ x = true;
+ else if (std::strcmp (v, "0") == 0 ||
+ std::strcmp (v, "false") == 0 ||
+ std::strcmp (v, "FALSE") == 0 ||
+ std::strcmp (v, "False") == 0)
+ x = false;
+ else
+ throw invalid_value (o, v);
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (bool& b, const bool&)
+ {
+ b = true;
+ }
+ };
+
+ template <>
+ struct parser<std::string>
+ {
+ static void
+ parse (std::string& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ x = s.next ();
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::string& b, const std::string& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::pair<X, std::size_t> >
+ {
+ static void
+ parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s)
+ {
+ x.second = s.position ();
+ parser<X>::parse (x.first, xs, s);
+ }
+
+ static void
+ merge (std::pair<X, std::size_t>& b, const std::pair<X, std::size_t>& a)
+ {
+ b = a;
+ }
+ };
+
+ template <typename X>
+ struct parser<std::vector<X> >
+ {
+ static void
+ parse (std::vector<X>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.push_back (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::vector<X>& b, const std::vector<X>& a)
+ {
+ b.insert (b.end (), a.begin (), a.end ());
+ }
+ };
+
+ template <typename X, typename C>
+ struct parser<std::set<X, C> >
+ {
+ static void
+ parse (std::set<X, C>& c, bool& xs, scanner& s)
+ {
+ X x;
+ bool dummy;
+ parser<X>::parse (x, dummy, s);
+ c.insert (x);
+ xs = true;
+ }
+
+ static void
+ merge (std::set<X, C>& b, const std::set<X, C>& a)
+ {
+ b.insert (a.begin (), a.end ());
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::map<K, V, C> >
+ {
+ static void
+ parse (std::map<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m[k] = v;
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::map<K, V, C>& b, const std::map<K, V, C>& a)
+ {
+ for (typename std::map<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b[i->first] = i->second;
+ }
+ };
+
+ template <typename K, typename V, typename C>
+ struct parser<std::multimap<K, V, C> >
+ {
+ static void
+ parse (std::multimap<K, V, C>& m, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (s.more ())
+ {
+ std::size_t pos (s.position ());
+ std::string ov (s.next ());
+ std::string::size_type p = ov.find ('=');
+
+ K k = K ();
+ V v = V ();
+ std::string kstr (ov, 0, p);
+ std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ()));
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (o),
+ 0
+ };
+
+ bool dummy;
+ if (!kstr.empty ())
+ {
+ av[1] = const_cast<char*> (kstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<K>::parse (k, dummy, s);
+ }
+
+ if (!vstr.empty ())
+ {
+ av[1] = const_cast<char*> (vstr.c_str ());
+ argv_scanner s (0, ac, av, false, pos);
+ parser<V>::parse (v, dummy, s);
+ }
+
+ m.insert (typename std::multimap<K, V, C>::value_type (k, v));
+ }
+ else
+ throw missing_value (o);
+
+ xs = true;
+ }
+
+ static void
+ merge (std::multimap<K, V, C>& b, const std::multimap<K, V, C>& a)
+ {
+ for (typename std::multimap<K, V, C>::const_iterator i (a.begin ());
+ i != a.end ();
+ ++i)
+ b.insert (typename std::multimap<K, V, C>::value_type (i->first,
+ i->second));
+ }
+ };
+
+ template <typename X, typename T, T X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, s);
+ }
+
+ template <typename X, bool X::*M>
+ void
+ thunk (X& x, scanner& s)
+ {
+ s.next ();
+ x.*M = true;
+ }
+
+ template <typename X, typename T, T X::*M, bool X::*S>
+ void
+ thunk (X& x, scanner& s)
+ {
+ parser<T>::parse (x.*M, x.*S, s);
+ }
+ }
+}
+
+#include <map>
+
+namespace bdep
+{
+ // cmd_update_options
+ //
+
+ cmd_update_options::
+ cmd_update_options ()
+ : immediate_ (),
+ recursive_ ()
+ {
+ }
+
+ bool cmd_update_options::
+ parse (int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_update_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ bool cmd_update_options::
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_update_options::
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ ::bdep::cli::argv_scanner s (start, argc, argv, erase);
+ bool r = _parse (s, opt, arg);
+ end = s.end ();
+ return r;
+ }
+
+ bool cmd_update_options::
+ parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt,
+ ::bdep::cli::unknown_mode arg)
+ {
+ bool r = _parse (s, opt, arg);
+ return r;
+ }
+
+ void cmd_update_options::
+ merge (const cmd_update_options& a)
+ {
+ CLI_POTENTIALLY_UNUSED (a);
+
+ // project_options base
+ //
+ ::bdep::project_options::merge (a);
+
+ if (a.immediate_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->immediate_, a.immediate_);
+ }
+
+ if (a.recursive_)
+ {
+ ::bdep::cli::parser< bool>::merge (
+ this->recursive_, a.recursive_);
+ }
+ }
+
+ ::bdep::cli::usage_para cmd_update_options::
+ print_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mUPDATE OPTIONS\033[0m" << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--immediate\033[0m|\033[1m-i\033[0m Also update immediate dependencies." << ::std::endl;
+
+ os << std::endl
+ << "\033[1m--recursive\033[0m|\033[1m-r\033[0m Also update all dependencies, recursively." << ::std::endl;
+
+ p = ::bdep::cli::usage_para::option;
+
+ // project_options base
+ //
+ p = ::bdep::project_options::print_usage (os, p);
+
+ return p;
+ }
+
+ struct _cli_cmd_update_options_desc_type: ::bdep::cli::options
+ {
+ _cli_cmd_update_options_desc_type ()
+ {
+ ::bdep::cmd_update_options::fill (*this);
+ }
+ };
+
+ void cmd_update_options::
+ fill (::bdep::cli::options& os)
+ {
+ // project_options base
+ //
+ ::bdep::project_options::fill (os);
+
+ // --immediate
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-i");
+ std::string dv;
+ ::bdep::cli::option o ("--immediate", a, true, dv);
+ os.push_back (o);
+ }
+
+ // --recursive
+ //
+ {
+ ::bdep::cli::option_names a;
+ a.push_back ("-r");
+ std::string dv;
+ ::bdep::cli::option o ("--recursive", a, true, dv);
+ os.push_back (o);
+ }
+ }
+
+ const ::bdep::cli::options& cmd_update_options::
+ description ()
+ {
+ static _cli_cmd_update_options_desc_type _cli_cmd_update_options_desc_;
+ return _cli_cmd_update_options_desc_;
+ }
+
+ typedef
+ std::map<std::string, void (*) (cmd_update_options&, ::bdep::cli::scanner&)>
+ _cli_cmd_update_options_map;
+
+ static _cli_cmd_update_options_map _cli_cmd_update_options_map_;
+
+ struct _cli_cmd_update_options_map_init
+ {
+ _cli_cmd_update_options_map_init ()
+ {
+ _cli_cmd_update_options_map_["--immediate"] =
+ &::bdep::cli::thunk< cmd_update_options, &cmd_update_options::immediate_ >;
+ _cli_cmd_update_options_map_["-i"] =
+ &::bdep::cli::thunk< cmd_update_options, &cmd_update_options::immediate_ >;
+ _cli_cmd_update_options_map_["--recursive"] =
+ &::bdep::cli::thunk< cmd_update_options, &cmd_update_options::recursive_ >;
+ _cli_cmd_update_options_map_["-r"] =
+ &::bdep::cli::thunk< cmd_update_options, &cmd_update_options::recursive_ >;
+ }
+ };
+
+ static _cli_cmd_update_options_map_init _cli_cmd_update_options_map_init_;
+
+ bool cmd_update_options::
+ _parse (const char* o, ::bdep::cli::scanner& s)
+ {
+ _cli_cmd_update_options_map::const_iterator i (_cli_cmd_update_options_map_.find (o));
+
+ if (i != _cli_cmd_update_options_map_.end ())
+ {
+ (*(i->second)) (*this, s);
+ return true;
+ }
+
+ // project_options base
+ //
+ if (::bdep::project_options::_parse (o, s))
+ return true;
+
+ return false;
+ }
+
+ bool cmd_update_options::
+ _parse (::bdep::cli::scanner& s,
+ ::bdep::cli::unknown_mode opt_mode,
+ ::bdep::cli::unknown_mode arg_mode)
+ {
+ // Can't skip combined flags (--no-combined-flags).
+ //
+ assert (opt_mode != ::bdep::cli::unknown_mode::skip);
+
+ bool r = false;
+ bool opt = true;
+
+ while (s.more ())
+ {
+ const char* o = s.peek ();
+
+ if (std::strcmp (o, "--") == 0)
+ {
+ opt = false;
+ }
+
+ if (opt)
+ {
+ if (_parse (o, s))
+ {
+ r = true;
+ continue;
+ }
+
+ if (std::strncmp (o, "-", 1) == 0 && o[1] != '\0')
+ {
+ // Handle combined option values.
+ //
+ std::string co;
+ if (const char* v = std::strchr (o, '='))
+ {
+ co.assign (o, 0, v - o);
+ ++v;
+
+ int ac (2);
+ char* av[] =
+ {
+ const_cast<char*> (co.c_str ()),
+ const_cast<char*> (v)
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (_parse (co.c_str (), ns))
+ {
+ // Parsed the option but not its value?
+ //
+ if (ns.end () != 2)
+ throw ::bdep::cli::invalid_value (co, v);
+
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = co.c_str ();
+ }
+ }
+
+ // Handle combined flags.
+ //
+ char cf[3];
+ {
+ const char* p = o + 1;
+ for (; *p != '\0'; ++p)
+ {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9')))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ for (p = o + 1; *p != '\0'; ++p)
+ {
+ std::strcpy (cf, "-");
+ cf[1] = *p;
+ cf[2] = '\0';
+
+ int ac (1);
+ char* av[] =
+ {
+ cf
+ };
+
+ ::bdep::cli::argv_scanner ns (0, ac, av);
+
+ if (!_parse (cf, ns))
+ break;
+ }
+
+ if (*p == '\0')
+ {
+ // All handled.
+ //
+ s.next ();
+ r = true;
+ continue;
+ }
+ else
+ {
+ // Set the unknown option and fall through.
+ //
+ o = cf;
+ }
+ }
+ }
+
+ switch (opt_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_option (o);
+ }
+ }
+
+ break;
+ }
+ }
+
+ switch (arg_mode)
+ {
+ case ::bdep::cli::unknown_mode::skip:
+ {
+ s.skip ();
+ r = true;
+ continue;
+ }
+ case ::bdep::cli::unknown_mode::stop:
+ {
+ break;
+ }
+ case ::bdep::cli::unknown_mode::fail:
+ {
+ throw ::bdep::cli::unknown_argument (o);
+ }
+ }
+
+ break;
+ }
+
+ return r;
+ }
+}
+
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_update_usage (::std::ostream& os, ::bdep::cli::usage_para p)
+ {
+ CLI_POTENTIALLY_UNUSED (os);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mSYNOPSIS\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mbdep update\033[0m [\033[4moptions\033[0m] [\033[4mpkg-spec\033[0m] [\033[4mcfg-spec\033[0m] [\033[4mcfg-var\033[0m...]\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[4mcfg-spec\033[0m = (\033[1m@\033[0m\033[4mcfg-name\033[0m | \033[1m--config\033[0m|\033[1m-c\033[0m \033[4mcfg-dir\033[0m)... | \033[1m--all\033[0m|\033[1m-a\033[0m" << ::std::endl
+ << "\033[4mpkg-spec\033[0m = (\033[4mpkg\033[0m | (\033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mpkg-dir\033[0m))... | \033[4mprj-spec\033[0m" << ::std::endl
+ << "\033[4mprj-spec\033[0m = \033[1m--directory\033[0m|\033[1m-d\033[0m \033[4mprj-dir\033[0m\033[0m" << ::std::endl
+ << ::std::endl
+ << "\033[1mDESCRIPTION\033[0m" << ::std::endl
+ << ::std::endl
+ << "The \033[1mupdate\033[0m command updates the project packages in one or more build" << ::std::endl
+ << "configurations. Additionally, immediate or all dependencies of the project" << ::std::endl
+ << "packages can be updated by specifying the \033[1m--immediate\033[0m|\033[1m-i\033[0m\033[0m or \033[1m--recursive\033[0m|\033[1m-r\033[0m\033[0m" << ::std::endl
+ << "options, respectively." << ::std::endl
+ << ::std::endl
+ << "Underneath \033[1mupdate\033[0m executes the \033[1mbpkg-pkg-update(1)\033[0m command which itself is not" << ::std::endl
+ << "much more than the build system \033[1mupdate\033[0m operation (see \033[1mb(1)\033[0m for details). As a" << ::std::endl
+ << "result, the main utility of this command is the ability to refer to build" << ::std::endl
+ << "configurations by names and to project packages implicitly via the current" << ::std::endl
+ << "working directory as well as to update dependencies." << ::std::endl
+ << ::std::endl
+ << "If no project or package directory is specified, then the current working" << ::std::endl
+ << "directory is assumed. If no configuration is specified, then the default" << ::std::endl
+ << "configurations are assumed. See \033[1mbdep-projects-configs(1)\033[0m for details on" << ::std::endl
+ << "specifying projects and configurations. Optional \033[4mcfg-var\033[0m...\033[0m are the additional" << ::std::endl
+ << "configuration variables to pass to the build system." << ::std::endl;
+
+ p = ::bdep::cmd_update_options::print_usage (os, ::bdep::cli::usage_para::text);
+
+ if (p != ::bdep::cli::usage_para::none)
+ os << ::std::endl;
+
+ os << "\033[1mDEFAULT OPTIONS FILES\033[0m" << ::std::endl
+ << ::std::endl
+ << "See \033[1mbdep-default-options-files(1)\033[0m for an overview of the default options files." << ::std::endl
+ << "For the \033[1mupdate\033[0m command the search start directory is the project directory. The" << ::std::endl
+ << "following options files are searched for in each directory and, if found," << ::std::endl
+ << "loaded in the order listed:" << ::std::endl
+ << ::std::endl
+ << "bdep.options" << ::std::endl
+ << "bdep-update.options" << ::std::endl
+ << ::std::endl
+ << "The following \033[1mupdate\033[0m command options cannot be specified in the default options" << ::std::endl
+ << "files:" << ::std::endl
+ << ::std::endl
+ << "--directory|-d" << ::std::endl;
+
+ p = ::bdep::cli::usage_para::text;
+
+ return p;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
diff --git a/bdep/update-options.hxx b/bdep/update-options.hxx
new file mode 100644
index 0000000..3920fb3
--- /dev/null
+++ b/bdep/update-options.hxx
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+#ifndef BDEP_UPDATE_OPTIONS_HXX
+#define BDEP_UPDATE_OPTIONS_HXX
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+#include <bdep/project-options.hxx>
+
+namespace bdep
+{
+ class cmd_update_options: public ::bdep::project_options
+ {
+ public:
+ cmd_update_options ();
+
+ // Return true if anything has been parsed.
+ //
+ bool
+ parse (int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ bool
+ parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option = ::bdep::cli::unknown_mode::fail,
+ ::bdep::cli::unknown_mode argument = ::bdep::cli::unknown_mode::stop);
+
+ // Merge options from the specified instance appending/overriding
+ // them as if they appeared after options in this instance.
+ //
+ void
+ merge (const cmd_update_options&);
+
+ // Option accessors and modifiers.
+ //
+ const bool&
+ immediate () const;
+
+ bool&
+ immediate ();
+
+ void
+ immediate (const bool&);
+
+ const bool&
+ recursive () const;
+
+ bool&
+ recursive ();
+
+ void
+ recursive (const bool&);
+
+ // Print usage information.
+ //
+ static ::bdep::cli::usage_para
+ print_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+
+ // Option description.
+ //
+ static const ::bdep::cli::options&
+ description ();
+
+ // Implementation details.
+ //
+ protected:
+ friend struct _cli_cmd_update_options_desc_type;
+
+ static void
+ fill (::bdep::cli::options&);
+
+ bool
+ _parse (const char*, ::bdep::cli::scanner&);
+
+ private:
+ bool
+ _parse (::bdep::cli::scanner&,
+ ::bdep::cli::unknown_mode option,
+ ::bdep::cli::unknown_mode argument);
+
+ public:
+ bool immediate_;
+ bool recursive_;
+ };
+}
+
+// Print page usage information.
+//
+namespace bdep
+{
+ ::bdep::cli::usage_para
+ print_bdep_update_usage (::std::ostream&,
+ ::bdep::cli::usage_para = ::bdep::cli::usage_para::none);
+}
+
+#include <bdep/update-options.ixx>
+
+// Begin epilogue.
+//
+//
+// End epilogue.
+
+#endif // BDEP_UPDATE_OPTIONS_HXX
diff --git a/bdep/update-options.ixx b/bdep/update-options.ixx
new file mode 100644
index 0000000..87ba24f
--- /dev/null
+++ b/bdep/update-options.ixx
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// This file was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// Begin prologue.
+//
+//
+// End prologue.
+
+namespace bdep
+{
+ // cmd_update_options
+ //
+
+ inline const bool& cmd_update_options::
+ immediate () const
+ {
+ return this->immediate_;
+ }
+
+ inline bool& cmd_update_options::
+ immediate ()
+ {
+ return this->immediate_;
+ }
+
+ inline void cmd_update_options::
+ immediate (const bool& x)
+ {
+ this->immediate_ = x;
+ }
+
+ inline const bool& cmd_update_options::
+ recursive () const
+ {
+ return this->recursive_;
+ }
+
+ inline bool& cmd_update_options::
+ recursive ()
+ {
+ return this->recursive_;
+ }
+
+ inline void cmd_update_options::
+ recursive (const bool& x)
+ {
+ this->recursive_ = x;
+ }
+}
+
+// Begin epilogue.
+//
+//
+// End epilogue.
diff --git a/buildfile b/buildfile
index da08ca9..09f1c20 100644
--- a/buildfile
+++ b/buildfile
@@ -1,7 +1,7 @@
# file : buildfile
# license : MIT; see accompanying LICENSE file
-./: {*/ -build/} \
+./: {*/ -build/ -doc/} \
doc{INSTALL NEWS README} legal{LICENSE AUTHORS LEGAL} \
manifest
diff --git a/repositories.manifest b/repositories.manifest
index 9837d08..853fea1 100644
--- a/repositories.manifest
+++ b/repositories.manifest
@@ -1,10 +1,8 @@
: 1
summary: build2 project dependency manager repository
-:
-role: prerequisite
-location: ../libbutl.git#HEAD
:
role: prerequisite
-location: ../libbpkg.git#HEAD
+location: https://stage.build2.org/1
+trust: EC:50:13:E2:3D:F7:92:B4:50:0B:BF:2A:1F:7D:31:04:C6:57:6F:BC:BE:04:2E:E0:58:14:FA:66:66:21:1F:14