test: Update 4 files
Some checks failed
Build-Test-Publish / build (linux/arm64) (push) Failing after 13s
Build-Test-Publish / build (linux/amd64) (push) Failing after 31s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Has been skipped
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Has been skipped
Some checks failed
Build-Test-Publish / build (linux/arm64) (push) Failing after 13s
Build-Test-Publish / build (linux/amd64) (push) Failing after 31s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Has been skipped
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Has been skipped
This commit is contained in:
@ -10,28 +10,39 @@ Usage: dehydrate [OPTIONS] SOURCE DEST
|
||||
Options:
|
||||
-s Silent mode (no output)
|
||||
-u Update dehydrate to the latest version
|
||||
-v Show version only
|
||||
|
||||
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
|
||||
dehydrate -v Shows version number
|
||||
)";
|
||||
|
||||
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;
|
||||
// Parse flags
|
||||
while (idx < argc && argv[idx][0] == '-') {
|
||||
std::string flag = argv[idx];
|
||||
|
||||
if (flag == "-s") {
|
||||
args.silent = true;
|
||||
} else if (flag == "-u") {
|
||||
args.update = true;
|
||||
} else if (flag == "-v") {
|
||||
args.version = true;
|
||||
} else {
|
||||
throw std::runtime_error("Unknown flag: " + flag + "\n\n" + HELP_TEXT);
|
||||
}
|
||||
|
||||
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
|
||||
// If update or version flag is set, return early
|
||||
if (args.update || args.version) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// Require source and dest parameters for normal operation
|
||||
|
Reference in New Issue
Block a user