Allow version and supported devices to be printed at runtime

This commit is contained in:
Paul Hollinsky
2018-11-20 10:41:42 -05:00
parent 2ade9116eb
commit 8a4e33c8df
7 changed files with 36 additions and 2 deletions
+11
View File
@@ -12,4 +12,15 @@ neoversion_t icsneo::GetVersion(void) {
version.buildBranch = GIT_BRANCH;
version.buildTag = GIT_DESCRIBE;
return version;
}
std::ostream& operator<<(std::ostream& os, const neoversion_t& version) {
os << 'v' << version.major << '.' << version.minor << '.' << version.patch;
if(version.metadata[0] != '\0')
os << '+' << version.metadata;
if(std::string(version.buildBranch) != "master")
os << ' ' << version.buildBranch << " @";
if(version.buildTag[0] != 'v')
os << ' ' << version.buildTag;
return os;
}