diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-03-21 21:56:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-03-23 16:25:12 +0300 |
commit | 51e1d64dccf4967eb078858529a0d7f05b8b461e (patch) | |
tree | e8314c5d2ece0964f828dedb203465e79d5a634b /bdep/new-types.hxx | |
parent | bba28902195a9aceb987d474cf2004d034932533 (diff) |
Add --post-hook option to bdep-new
Diffstat (limited to 'bdep/new-types.hxx')
-rw-r--r-- | bdep/new-types.hxx | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/bdep/new-types.hxx b/bdep/new-types.hxx index 9d19c48..96aaa7c 100644 --- a/bdep/new-types.hxx +++ b/bdep/new-types.hxx @@ -46,20 +46,26 @@ namespace bdep // cmd_new_type_template (): type (exe) {} - friend ostream& - operator<< (ostream& os, const cmd_new_type_template& t) + const std::string + string () const { using type = cmd_new_type_template; - switch (t) + switch (*this) { - case type::exe: return os << "executable"; - case type::lib: return os << "library"; - case type::bare: return os << "bare"; - case type::empty: return os << "empty"; + case type::exe: return "executable"; + case type::lib: return "library"; + case type::bare: return "bare"; + case type::empty: return "empty"; } - return os; + return string (); // Should never reach. + } + + friend ostream& + operator<< (ostream& os, const cmd_new_type_template& t) + { + return os << t.string (); } }; @@ -84,6 +90,20 @@ namespace bdep // Default is C++ with no options. // cmd_new_lang_template (): lang (cxx) {} + + const std::string + string () const + { + using lang = cmd_new_lang_template; + + switch (*this) + { + case lang::c: return "c"; + case lang::cxx: return "c++"; + } + + return string (); // Should never reach. + } }; using cmd_new_lang = cmd_new_lang_template<>; @@ -107,6 +127,20 @@ namespace bdep // Default is git with no options. // cmd_new_vcs_template (): vcs (git) {} + + const std::string + string () const + { + using vcs = cmd_new_vcs_template; + + switch (*this) + { + case vcs::git: return "git"; + case vcs::none: return "none"; + } + + return string (); // Should never reach. + } }; using cmd_new_vcs = cmd_new_vcs_template<>; |