Skip to content

Commit

Permalink
Show project version and repo URL in usage, bump version to 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpalmisc committed Nov 26, 2023
1 parent b5153b9 commit 25cee1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(respawn VERSION 0.1.0)
project(respawn VERSION 1.0.1)

add_subdirectory(external/argh EXCLUDE_FROM_ALL)
add_subdirectory(external/sioku EXCLUDE_FROM_ALL)
Expand All @@ -21,6 +21,8 @@ add_executable(respawn
src/repl.cpp
src/usb/client.cpp)
target_compile_features(respawn PRIVATE cxx_std_17)
target_compile_definitions(respawn PRIVATE
CMAKE_PROJECT_VERSION="${CMAKE_PROJECT_VERSION}")
target_include_directories(respawn PRIVATE include)
target_link_libraries(respawn PRIVATE
argh
Expand Down
9 changes: 8 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@

#include <iostream>

constexpr auto USAGE = R"(Usage: respawn [-spIrvVh]
#ifndef CMAKE_PROJECT_VERSION
#define CMAKE_PROJECT_VERSION "?.?.?"
#endif

constexpr auto USAGE = R"(
Usage: respawn [-spIrvVh]
Options:
-s, --serial Only print the device's serial, then exit
Expand Down Expand Up @@ -60,6 +65,8 @@ static Chip parse_cpid(const std::string &serial) {
int main(int argc, char const **argv) {
argh::parser args(argc, argv, argh::parser::SINGLE_DASH_IS_MULTIFLAG);
if (args[{"-h", "--help"}]) {
std::cout << "Respawn " CMAKE_PROJECT_VERSION
<< " <https://github.com/jonpalmisc/respawn>\n";
std::cout << USAGE;
return 0;
}
Expand Down

0 comments on commit 25cee1e

Please sign in to comment.