diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-22 19:34:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-22 19:34:51 +0200 |
commit | 7e7dee76c870917866fd23f385211ee8101705b4 (patch) | |
tree | b78508ec5316b6f50cbf4417337b96e874bdf439 /bdep/project-author.hxx | |
parent | b2c194aa4913afee30a78fc191912b9622a4d9ae (diff) |
Add support for specifying publisher's name in addition to email
Diffstat (limited to 'bdep/project-author.hxx')
-rw-r--r-- | bdep/project-author.hxx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bdep/project-author.hxx b/bdep/project-author.hxx new file mode 100644 index 0000000..bcabdb3 --- /dev/null +++ b/bdep/project-author.hxx @@ -0,0 +1,41 @@ +// file : bdep/project-author.hxx -*- C++ -*- +// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BDEP_PROJECT_AUTHOR_HXX +#define BDEP_PROJECT_AUTHOR_HXX + +#include <bdep/types.hxx> +#include <bdep/utility.hxx> + +namespace bdep +{ + // Given a project directly, try to discover the author's name/email address + // using the environment and, if project looks like a repository, its VCS. + // + // Note: if using this function in a command, don't forget to update its + // ENVIRONMENT section to mention BDEP_AUTHOR_{NAME,EMAIL}. + // + struct project_author + { + optional<string> name; + optional<string> email; + }; + + project_author + find_project_author (const dir_path&); + + inline optional<string> + find_project_author_name (const dir_path& d) + { + return find_project_author (d).name; + } + + inline optional<string> + find_project_author_email (const dir_path& d) + { + return find_project_author (d).email; + } +} + +#endif // BDEP_PROJECT_AUTHOR_HXX |