test: Update 19 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 34s
Build-Test-Publish / build (linux/arm64) (push) Successful in 44s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 8s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s

This commit is contained in:
Your Name
2025-06-22 23:10:39 +12:00
parent 0065a41012
commit dd0fc37798
19 changed files with 8379 additions and 0 deletions

View File

@ -0,0 +1,45 @@
#include "argparse.hpp"
#include <stdexcept>
static const std::string HELP_TEXT = R"(
Converts existing files to C++ source code which can be used to recreate the original files.
Usage: dehydrate [OPTIONS] SOURCE DEST
Options:
-s Silent mode (no output)
-u Update dehydrate to the latest version
Examples:
dehydrate file.txt output/ Creates _file.txt.cpp and _file.txt.hpp in output/
dehydrate src/ output/ Creates _src.cpp and _src.hpp in output/
dehydrate -u Updates dehydrate to the latest version
)";
Args parse_args(int argc, char* argv[]) {
Args args;
int idx = 1;
// Check for silent flag
if (idx < argc && std::string(argv[idx]) == "-s") {
args.silent = true;
idx++;
}
// Check for update flag
if (idx < argc && std::string(argv[idx]) == "-u") {
args.update = true;
idx++;
return args; // No need for source and dest parameters when updating
}
// Require source and dest parameters for normal operation
if (argc - idx != 2) {
throw std::runtime_error(HELP_TEXT);
}
args.source = argv[idx];
args.dest = argv[idx + 1];
return args;
}