summaryrefslogtreecommitdiff
path: root/assets/cpp/version.cpp
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-29 14:48:38 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-29 14:48:38 +1000
commit416a41affeaecf1ac6720fde4bae5d33e5ec3d75 (patch)
tree837c3d4acd4418363d6924f620a48f076dca7d41 /assets/cpp/version.cpp
parentnix: fixes (diff)
downloadcaelestia-shell-416a41affeaecf1ac6720fde4bae5d33e5ec3d75.tar.gz
caelestia-shell-416a41affeaecf1ac6720fde4bae5d33e5ec3d75.tar.bz2
caelestia-shell-416a41affeaecf1ac6720fde4bae5d33e5ec3d75.zip
lib: add version script
Diffstat (limited to 'assets/cpp/version.cpp')
-rw-r--r--assets/cpp/version.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/assets/cpp/version.cpp b/assets/cpp/version.cpp
new file mode 100644
index 0000000..e1a0cf3
--- /dev/null
+++ b/assets/cpp/version.cpp
@@ -0,0 +1,26 @@
+#include <iostream>
+
+int main(int argc, char* argv[]) {
+ if (argc > 1) {
+ std::string arg = argv[1];
+
+ if (arg == "-t" || arg == "--terse") {
+ std::cout << PROJECT_NAME << std::endl;
+ std::cout << VERSION << std::endl;
+ std::cout << GIT_REVISION << std::endl;
+ std::cout << DISTRIBUTOR << std::endl;
+ } else if (arg == "-s" || arg == "--short") {
+ std::cout << PROJECT_NAME << " " << VERSION << ", revision " << GIT_REVISION << ", distrubuted by: " << DISTRIBUTOR << std::endl;
+ } else {
+ std::cout << "Usage: " << argv[0] << " [-t | --terse] [-s | --short]" << std::endl;
+ return arg != "-h" && arg != "--help";
+ }
+ } else {
+ std::cout << "Project: " << PROJECT_NAME << std::endl;
+ std::cout << "Version: " << VERSION << std::endl;
+ std::cout << "Git revision: " << GIT_REVISION << std::endl;
+ std::cout << "Distributor: " << DISTRIBUTOR << std::endl;
+ }
+
+ return 0;
+}