Put regex type and --grep in search::options.

This commit is contained in:
tastytea 2021-05-24 13:13:15 +02:00
parent b2e70a6faa
commit 4e01032c6f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 25 additions and 2 deletions

View File

@ -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;

View File

@ -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};