mirror of
https://github.com/sametersoylu/argument-parser.git
synced 2026-04-13 03:41:18 +00:00
feat: Introduce core argument parsing framework with platform-specific parsers, conventions, and type-based value parsing.
This commit is contained in:
18
src/source/parser/platform_parsers/linux_parser.cpp
Normal file
18
src/source/parser/platform_parsers/linux_parser.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifdef __linux__
|
||||
|
||||
#include "linux_parser.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
namespace argument_parser {
|
||||
linux_parser::linux_parser() {
|
||||
std::ifstream command_line_file{"/proc/self/cmdline"};
|
||||
std::getline(command_line_file, program_name, '\0');
|
||||
for (std::string line; std::getline(command_line_file, line, '\0');) {
|
||||
parsed_arguments.emplace_back(line);
|
||||
}
|
||||
}
|
||||
} // namespace argument_parser
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user