make sets work
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
const static int EXIT_EARLY_SUCCESS = 400;
|
const static int EXIT_EARLY_SUCCESS = 400;
|
||||||
enum {
|
enum {
|
||||||
UNKNOWN_OPTION = 1,
|
UNKNOWN_OPTION = 1,
|
||||||
IO_ERROR = 2,
|
IO_ERROR = 2,
|
||||||
|
UNKNOWN_SET = 3,
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "cli.h"
|
#include "cli.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
@ -25,6 +26,10 @@ char * output = NULL;
|
|||||||
char * input = NULL;
|
char * input = NULL;
|
||||||
const char * const csml_extension = ".csml";
|
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 {
|
enum class input_type_t {
|
||||||
CSML,
|
CSML,
|
||||||
XML,
|
XML,
|
||||||
@ -116,7 +121,16 @@ signed main(int argc, char * * argv) {
|
|||||||
char * data = strtok(argv[n], delimiter);
|
char * data = strtok(argv[n], delimiter);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
do {
|
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;
|
++i;
|
||||||
} while((data = strtok(NULL, delimiter), data));
|
} while((data = strtok(NULL, delimiter), data));
|
||||||
} else if (!strcmp(argv[n], "-o")) {
|
} else if (!strcmp(argv[n], "-o")) {
|
||||||
|
Reference in New Issue
Block a user