Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Add version argument
Browse files Browse the repository at this point in the history
Resolves #40
  • Loading branch information
erri120 committed Apr 7, 2021
1 parent c7a5bbe commit ffcb279
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Get version from input
id: tag_name
shell: bash
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
echo ::set-output name=current_version::${INPUT_VERSION}
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
Expand All @@ -32,7 +40,7 @@ jobs:
working-directory: ${{github.workspace}}
run: |
cmake -E make_directory build/
cmake -S . -B build/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE
cmake -S . -B build/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRPGMPACKER_VERSION=${{ steps.tag_name.outputs.current_version }}
cmake --build build/ --config $BUILD_TYPE
- name: Test (Windows)
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog][Keep a Changelog] and this project adh

## [Released]

## [1.6.2] - 2021-04-07

### Added

- Added `--version` argument for printing the program version ([#40](https://github.com/erri120/rpgmpacker/issues/40))

## [1.6.1] - 2021-04-05

### Added
Expand Down Expand Up @@ -135,8 +141,9 @@ This change does not change anything for the end-consumer of the tool but is a h
[Semantic Versioning]: https://semver.org/

<!-- Versions -->
[Unreleased]: https://github.com/erri120/rpgmpacker/compare/v1.6.1...HEAD
[Unreleased]: https://github.com/erri120/rpgmpacker/compare/v1.6.2...HEAD
[Released]: https://github.com/erri120/rpgmpacker/releases/
[1.6.1]: https://github.com/erri120/rpgmpacker/compare/v1.6.1...v1.6.2
[1.6.1]: https://github.com/erri120/rpgmpacker/compare/v1.6.0...v1.6.1
[1.6.0]: https://github.com/erri120/rpgmpacker/compare/v1.5.4...v1.6.0
[1.5.4]: https://github.com/erri120/rpgmpacker/compare/v1.5.3...v1.5.4
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Simple CLI program for packaging RPG Maker games to use in an automated build/de
(default: 2)
-d, --debug Enable debugging output (very noisy). (default:
false)
-v, --version Print version
-h, --help Print usage
```

Expand Down
4 changes: 4 additions & 0 deletions RPGMPacker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU"
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
# GCC/Clang
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
endif()

if(RPGMPACKER_VERSION)
add_compile_definitions(RPGMPACKER_VERSION="${RPGMPACKER_VERSION}")
endif()
12 changes: 12 additions & 0 deletions RPGMPacker/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include <parseData.hpp>
#include <inputPaths.hpp>

#ifndef RPGMPACKER_VERSION
#define RPGMPACKER_VERSION "1.0.0"
#endif

int main(int argc, char** argv) {
std::error_code ec;
auto logger = spdlog::stdout_color_mt("console");
Expand All @@ -41,6 +45,7 @@ int main(int argc, char** argv) {
("cache", "Use a path cache for already encrypted files when multi-targeting and using hardlinks. (default: false)", cxxopts::value<bool>()->default_value("false"))
("threads", "Amount of worker threads to use. Min: 1, Max: 10", cxxopts::value<int>()->default_value("2"))
("d,debug", "Enable debugging output (very noisy). (default: false)", cxxopts::value<bool>()->default_value("false"))
("v,version", "Print version")
("h,help", "Print usage");

std::string input, output, rpgmaker, encryptionKey;
Expand All @@ -53,6 +58,12 @@ int main(int argc, char** argv) {

if (result.count("help")) {
std::cout << options.help() << std::endl;
std::cout << RPGMPACKER_VERSION << std::endl;
return EXIT_SUCCESS;
}

if (result.count("version")) {
std::cout << RPGMPACKER_VERSION << std::endl;
return EXIT_SUCCESS;
}

Expand Down Expand Up @@ -129,6 +140,7 @@ var = toml::find<type>(tomlConfig, name);\
}

//input dump
logger->info("Version: {}", RPGMPACKER_VERSION);
logger->info("Input: {}", input);
logger->info("Output: {}", output);
logger->info("RPG Maker: {}", rpgmaker);
Expand Down

0 comments on commit ffcb279

Please sign in to comment.