-
Notifications
You must be signed in to change notification settings - Fork 994
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a version command to simpleshell
Print out version and build date on startup makfile generates a new src/version.cpp with current git branch and hash and build date time
- Loading branch information
Showing
7 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
echo "#include \"version.h\"" > src/version.cpp | ||
echo "const char *Version::get_build(void) const {" >> src/version.cpp | ||
echo " return \"`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:\"%h\" -1`\";" >> src/version.cpp | ||
echo "}" >> src/version.cpp | ||
echo "const char *Version::get_build_date(void) const {" >> src/version.cpp | ||
echo " return __DATE__ \" \" __TIME__;" >> src/version.cpp | ||
echo "}" >> src/version.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "version.h" | ||
const char *Version::get_build(void) const { | ||
return "placeholder"; | ||
} | ||
const char *Version::get_build_date(void) const { | ||
return __DATE__ " " __TIME__; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef _VERSION__H | ||
#define _VERSION__H | ||
class Version { | ||
public: | ||
const char *get_build(void) const; | ||
const char *get_build_date(void) const; | ||
}; | ||
#endif |