make sets work
This commit is contained in:
parent
b9ab4ab13c
commit
bd44d470a8
@ -1,5 +1,6 @@
|
||||
const static int EXIT_EARLY_SUCCESS = 400;
|
||||
enum {
|
||||
UNKNOWN_OPTION = 1,
|
||||
IO_ERROR = 2,
|
||||
UNKNOWN_OPTION = 1,
|
||||
IO_ERROR = 2,
|
||||
UNKNOWN_SET = 3,
|
||||
};
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <libgen.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "cli.h"
|
||||
#include "globals.h"
|
||||
@ -25,6 +26,10 @@ char * output = NULL;
|
||||
char * input = NULL;
|
||||
const char * const csml_extension = ".csml";
|
||||
|
||||
const std::map<const char * const, std::vector<std::string>> sets = {
|
||||
{"$html", {"style", "script"}},
|
||||
};
|
||||
|
||||
enum class input_type_t {
|
||||
CSML,
|
||||
XML,
|
||||
@ -116,7 +121,16 @@ signed main(int argc, char * * argv) {
|
||||
char * data = strtok(argv[n], delimiter);
|
||||
int i = 0;
|
||||
do {
|
||||
ignore_list.emplace_back(data);
|
||||
if (data[0] == '$') {
|
||||
const auto &&set = sets.find("$html");
|
||||
[[ likely ]] if (set != sets.end()) {
|
||||
ignore_list.insert(ignore_list.begin(), set->second.begin(), set->second.end());
|
||||
} else {
|
||||
exit(UNKNOWN_SET);
|
||||
}
|
||||
} else [[ likely ]] {
|
||||
ignore_list.emplace_back(data);
|
||||
}
|
||||
++i;
|
||||
} while((data = strtok(NULL, delimiter), data));
|
||||
} else if (!strcmp(argv[n], "-o")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user