Put regex type and --grep in search::options.
This commit is contained in:
parent
b2e70a6faa
commit
4e01032c6f
17
src/main.cpp
17
src/main.cpp
|
@ -83,7 +83,22 @@ int main(int argc, char *argv[])
|
|||
vm["regexp"].as<std::vector<std::string>>())
|
||||
{
|
||||
search::options opts;
|
||||
// TODO: regex type.
|
||||
if (vm.count("basic-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_type::basic;
|
||||
}
|
||||
if (vm.count("extended-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_type::extended;
|
||||
}
|
||||
if (vm.count("perl-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_type::perl;
|
||||
}
|
||||
if (vm.count("grep") > 0)
|
||||
{
|
||||
opts.grep_like = true;
|
||||
}
|
||||
if (vm.count("ignore-case") > 0)
|
||||
{
|
||||
opts.ignore_case = true;
|
||||
|
|
|
@ -39,9 +39,17 @@ struct match
|
|||
std::string page; //!< The page number, if available.
|
||||
};
|
||||
|
||||
enum class regex_type
|
||||
{
|
||||
basic,
|
||||
extended,
|
||||
perl
|
||||
};
|
||||
|
||||
struct options
|
||||
{
|
||||
// TODO: regex type
|
||||
regex_type regex{regex_type::basic};
|
||||
bool grep_like{false};
|
||||
bool ignore_case{false};
|
||||
bool nostrip{false};
|
||||
std::uint64_t context{0};
|
||||
|
|
Loading…
Reference in New Issue
Block a user