Skip to content

Commit

Permalink
Bump to 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyseek committed Feb 2, 2023
1 parent 6739c5f commit be79f78
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.1.0 (2023-02-02)

- The first release which uses a UDP socket on a loopback address. ([#1](https://github.com/tonyseek/trapit/pull/1))
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
cmake_minimum_required(VERSION 3.22..3.25)
project(trapit)
project(trapit VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_executable(trapit trapit.cc)
target_compile_definitions(
trapit PRIVATE TRAPIT_VERSION="${CMAKE_PROJECT_VERSION}")
install(TARGETS trapit)

set(CPACK_PACKAGE_VENDOR "Jiangge Zhang <[email protected]>")
Expand Down
16 changes: 15 additions & 1 deletion trapit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
#define TRAPIT_PORT 26842
#endif

#ifndef TRAPIT_VERSION
#define TRAPIT_VERSION "unstable"
#endif

const std::string version(TRAPIT_VERSION);

int cmd_usage(const char *prog) noexcept;
int cmd_version(const char *prog) noexcept;
int cmd_trap(const char *prog, int argc, char **argv) noexcept;
int cmd_wake(const char *prog, int argc, char **argv) noexcept;

Expand Down Expand Up @@ -56,6 +63,8 @@ int main(int argc, char **argv) {
} else if (strcmp(argv[1], "help") == 0) {
cmd_usage(argv[0]);
return 0;
} else if (strcmp(argv[1], "version") == 0) {
return cmd_version(argv[0]);
} else {
return cmd_usage(argv[0]);
}
Expand All @@ -65,12 +74,17 @@ int main(int argc, char **argv) {
int cmd_usage(const char *prog) noexcept {
const char *hl = "Usage: ";
const char *pr = " ";
std::cerr << hl << prog << " [exec|wake|help]" << std::endl;
std::cerr << hl << prog << " [exec|wake|version|help]" << std::endl;
std::cerr << pr << prog << " exec -- [argument ...]" << std::endl;
std::cerr << pr << prog << " wake" << std::endl;
return 2;
}

int cmd_version(const char *prog) noexcept {
std::cout << version << std::endl;
return 0;
}

int cmd_trap(const char *prog, int argc, char **argv) noexcept {
/*
* Layout: [ARG 0] [ARG 0] [ARG 1] ... [NULL]
Expand Down

0 comments on commit be79f78

Please sign in to comment.