cell-cli target, updated vcpkg, installed CLI11#79
Draft
yannik131 wants to merge 22 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new cell-cli executable intended to run the cell simulation from the command line (Issue #77), wiring in CLI11 via vcpkg/CMake and introducing a SimulationRunner abstraction in libcell.
Changes:
- Added CLI11 dependency (vcpkg + top-level
find_package) and a newcell-cliCMake target. - Introduced
cell::SimulationRunnerAPI and a CLI frontend that parses--config/--out/--duration. - Adjusted
cell-guilink visibility toPRIVATE.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| vcpkg.json | Adds cli11 dependency for the new CLI app. |
| src/lib/cell/SimulationRunner.hpp | Declares a runner API for config/out/duration-driven simulation runs. |
| src/lib/cell/SimulationRunner.cpp | Adds (currently empty) runner method definitions. |
| src/apps/cell-gui/CMakeLists.txt | Makes cell-gui link to libcellgui as PRIVATE. |
| src/apps/cell-cli/Main.cpp | Implements argument parsing and invokes SimulationRunner. |
| src/apps/cell-cli/CMakeLists.txt | Adds the cell-cli executable target and links against libcell + CLI11. |
| CMakeLists.txt | Finds CLI11 and adds the cell-cli subdirectory to the build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+16
| #include "SimulationRunner.hpp" | ||
|
|
||
| void cell::SimulationRunner::useConfigFile(const fs::path& configFile) | ||
| { | ||
| } | ||
|
|
||
| void cell::SimulationRunner::setOutFile(const fs::path& outFile) | ||
| { | ||
| } | ||
|
|
||
| void cell::SimulationRunner::setSimulationTime(const std::chrono::duration<double>& simulationTime) | ||
| { | ||
| } | ||
|
|
||
| void cell::SimulationRunner::runSimulation() | ||
| { |
Comment on lines
+12
to
+18
| class SimulationRunner | ||
| { | ||
| public: | ||
| void useConfigFile(const fs::path& configFile); | ||
| void setOutFile(const fs::path& outFile); | ||
| void setSimulationTime(const std::chrono::duration<double>& simulationTime); | ||
| void runSimulation(); |
Comment on lines
+38
to
+41
| app.add_option("--config", configFile, "Config file")->required()->check(CLI::ExistingFile); | ||
| app.add_option("--out", outFile, "Output file (type counts)")->required(); | ||
| app.add_option("--duration", duration, "Target simulation time in seconds")->required()->check(positiveDouble); | ||
|
|
Comment on lines
+19
to
+36
| CLI::Validator positiveDouble{[](const std::string& value) -> std::string | ||
| { | ||
| try | ||
| { | ||
| std::size_t pos = 0; | ||
| const double result = std::stod(value, &pos); | ||
| if (pos != value.size()) | ||
| throw std::exception{}; | ||
| else if (result <= 0.0) | ||
| return "must be > 0"; | ||
| return {}; | ||
| } | ||
| catch (...) | ||
| { | ||
| return "not a valid floating-point number"; | ||
| } | ||
| }, | ||
| "POSITIVE_DOUBLE"}; |
Comment on lines
+11
to
+14
| int main(int argc, char** argv) | ||
| { | ||
| CLI::App app{"Command line interface for the cell simulation"}; | ||
|
|
"cmake.debugConfig": {
"args": [
"--config=..\\..\\test\\resources\\preyPredator.json",
"--out=out.csv",
"--duration=5"
],
"cwd": "${workspaceFolder}/build_debug/Debug"
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #77