Implement platform-specific parsers for Windows, Linux, and macOS Add GNU argument convention implementations Create fake parser for testing purposes Update CMakeLists to include new headers
27 lines
659 B
C++
27 lines
659 B
C++
#pragma once
|
|
#ifdef __APPLE__
|
|
#ifndef MACOS_PARSER_HPP
|
|
#define MACOS_PARSER_HPP
|
|
|
|
#include <argument_parser.hpp>
|
|
#include <crt_externs.h>
|
|
#include <string>
|
|
|
|
namespace argument_parser {
|
|
class macos_parser : public base_parser {
|
|
public:
|
|
macos_parser() {
|
|
int argc = *_NSGetArgc();
|
|
char **argv = *_NSGetArgv();
|
|
if (argc > 0 && argv != nullptr && argv[0] != nullptr) {
|
|
program_name = argv[0];
|
|
for (int i = 1; i < argc; ++i) {
|
|
if (argv[i] != nullptr) parsed_arguments.emplace_back(argv[i]);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif
|
|
#endif |