diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-04 22:47:40 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-04 22:47:40 +1000 |
| commit | e6483d793245ee6a0faba895ee8c13c9aed75409 (patch) | |
| tree | 88ccd0311aa7c74b725b0b332219fdf6f6fc034a /extras | |
| parent | internal: remove beat-detector.cpp (diff) | |
| download | caelestia-shell-e6483d793245ee6a0faba895ee8c13c9aed75409.tar.gz caelestia-shell-e6483d793245ee6a0faba895ee8c13c9aed75409.tar.bz2 caelestia-shell-e6483d793245ee6a0faba895ee8c13c9aed75409.zip | |
internal: rename assets -> extras
Diffstat (limited to 'extras')
| -rw-r--r-- | extras/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | extras/version.cpp | 26 |
2 files changed, 35 insertions, 0 deletions
diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt new file mode 100644 index 0000000..52fe17c --- /dev/null +++ b/extras/CMakeLists.txt @@ -0,0 +1,9 @@ +# Version +add_executable(version version.cpp) +target_compile_definitions(version PRIVATE + PROJECT_NAME="${PROJECT_NAME}" + VERSION="${VERSION}" + GIT_REVISION="${GIT_REVISION}" + DISTRIBUTOR="${DISTRIBUTOR}" +) +install(TARGETS version DESTINATION ${INSTALL_LIBDIR}) diff --git a/extras/version.cpp b/extras/version.cpp new file mode 100644 index 0000000..e1a0cf3 --- /dev/null +++ b/extras/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; +} |