Enhance command-line interface with cxxopts for argument parsing and add playful responses

This commit is contained in:
Dominik Krenn 2025-07-03 12:28:24 +02:00
parent 0bf90124f1
commit fe42bd43bf
2 changed files with 31 additions and 12 deletions

7
debian/changelog vendored
View File

@ -1,12 +1,11 @@
jigsaw (0.1-3) bookworm; urgency=medium
* Added console line argument parsing
* Added a dummy menu
* Added a help menu
* Added command-line argument parsing using cxxopts
* Implemented --help, --version, --play, and --sphageti options with basic responses
* Added a simple help menu and playful output for no arguments
-- Jack <contact@chipperfluff.at> Tue, 02 Jul 2025 15:10:00 +0200
jigsaw (0.1-2) bookworm; urgency=medium
* Made it executable

View File

@ -2,29 +2,49 @@
#include <string>
#include "../includes/cxxopts/include/cxxopts.hpp"
#define VERSION_STRING "0.1.3"
int main(int argc, char* argv[]) {
try {
cxxopts::Options options("jigsaw", "CLI horror filler program");
cxxopts::Options options("jigsaw", "This is a test APT repo. Maybe a game later.");
options.add_options()
("h,help", "Show help")
("p,play", "Play the game");
("h,help", "Show this help message")
("v,version", "Show version")
("p,play", "Get a SANS response")
("s,sphageti", "Summon Papyrus");
auto result = options.parse(argc, argv);
if (result.count("help")) {
std::cout << options.help() << std::endl;
std::cout << options.help() << "\n";
std::cout << "Hint: This tool is part of a test APT repo — maybe it becomes a game later 👀\n";
return 0;
}
if (result.count("version")) {
std::cout << "jigsaw version " << VERSION_STRING << "\n";
return 0;
}
if (result.count("play")) {
std::cout << "Initiating game sequence... (placeholder)\n";
} else {
std::cout << "Hello. I am a filler. And I want to play a game.\n";
std::cout << "SANS: heya. you're gonna have a bad time if you keep doing that.\n";
return 0;
}
if (result.count("sphageti")) {
std::cout << "PAPYRUS: NYEH HEH HEH!! SPAGHETTI FOR ALL!!\n";
return 0;
}
// No arguments provided
if (result.arguments().empty()) {
std::cout << "hahahah u thought somethign hapsn here?\n";
return 0;
}
} catch (const std::exception& e) {
std::cerr << "Error parsing options: " << e.what() << std::endl;
std::cerr << "Error parsing options: " << e.what() << "\n";
return 1;
}