chore: add v2 version of the linux parser

This commit is contained in:
2026-03-16 17:52:54 +04:00
parent a1ada5a792
commit fed2eb998c
2 changed files with 21 additions and 0 deletions

View File

@@ -5,12 +5,20 @@
#define LINUX_PARSER_HPP
#include <argument_parser.hpp>
#include <parser_v2.hpp>
namespace argument_parser {
class linux_parser : public base_parser {
public:
linux_parser();
};
namespace v2 {
class linux_parser : public v2::base_parser {
public:
linux_parser();
};
} // namespace v2
} // namespace argument_parser
#endif

View File

@@ -13,6 +13,19 @@ namespace argument_parser {
parsed_arguments.emplace_back(line);
}
}
namespace v2 {
linux_parser::linux_parser() {
std::ifstream command_line_file{"/proc/self/cmdline"};
std::string program_name;
std::getline(command_line_file, program_name, '\0');
set_program_name(program_name);
for (std::string line; std::getline(command_line_file, line, '\0');) {
parsed_arguments.emplace_back(line);
}
}
} // namespace v2
} // namespace argument_parser
#endif