mirror of
https://github.com/sametersoylu/argument-parser.git
synced 2026-04-13 03:41:18 +00:00
feat: Introduce a modular argument convention system for GNU and Windows styles, add .clang-format, and update CMake configuration to C++17.
This commit is contained in:
25
src/headers/parser/platform_headers/linux_parser.hpp
Normal file
25
src/headers/parser/platform_headers/linux_parser.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __linux__
|
||||
#ifndef LINUX_PARSER_HPP
|
||||
#define LINUX_PARSER_HPP
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include <argument_parser.hpp>
|
||||
|
||||
namespace argument_parser {
|
||||
class linux_parser : public base_parser {
|
||||
public:
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user