Rename exclude options + minor code reformat

This commit is contained in:
zawz 2020-11-06 17:43:37 +01:00
parent a777608f08
commit dda4a87b28
2 changed files with 17 additions and 17 deletions

View file

@ -42,21 +42,21 @@ std::vector<std::pair<KEY, VAL>> sort_by_value(std::map<KEY,VAL> const& in)
{ {
typedef std::pair<KEY,VAL> pair_t; typedef std::pair<KEY,VAL> pair_t;
// create an empty vector of pairs // create an empty vector of pairs
std::vector<pair_t> ret; std::vector<pair_t> ret;
// copy key-value pairs from the map to the vector // copy key-value pairs from the map to the vector
std::copy(in.begin(), std::copy(in.begin(),
in.end(), in.end(),
std::back_inserter<std::vector<pair_t>>(ret)); std::back_inserter<std::vector<pair_t>>(ret));
// sort the vector by increasing order of its pair's second value // sort the vector by increasing order of its pair's second value
// if second value are equal, order by the pair's first value // if second value are equal, order by the pair's first value
std::sort(ret.begin(), ret.end(), std::sort(ret.begin(), ret.end(),
[](const pair_t& l, const pair_t& r) { [](const pair_t& l, const pair_t& r) {
if (l.second != r.second) if (l.second != r.second)
return l.second > r.second; return l.second > r.second;
return l.first > r.first; return l.first > r.first;
}); });
return ret; return ret;
} }

View file

@ -27,11 +27,11 @@ ztd::option_set gen_options()
ztd::option('e', "exec", false, "Directly execute script"), ztd::option('e', "exec", false, "Directly execute script"),
ztd::option("\r [var/fct processing]"), ztd::option("\r [var/fct processing]"),
ztd::option("minimize-var", false, "Minimize variable names"), ztd::option("minimize-var", false, "Minimize variable names"),
ztd::option("minimize-fct", false, "Minimize function names"), ztd::option("minimize-fct", false, "Minimize function names"),
ztd::option("var-exclude", true, "List of matching regex to ignore for variable processing", "list"), ztd::option("exclude-var", true, "List of matching regex to ignore for variable processing", "list"),
ztd::option("fct-exclude", true, "List of matching regex to ignore for function processing", "list"), ztd::option("exclude-fct", true, "List of matching regex to ignore for function processing", "list"),
ztd::option("list-var", false, "List all variables invoked in the script"), ztd::option("list-var", false, "List all variables invoked in the script"),
ztd::option("list-fct", false, "List all functions invoked in the script"), ztd::option("list-fct", false, "List all functions invoked in the script"),
ztd::option("list-cmd", false, "List all functions invoked in the script"), ztd::option("list-cmd", false, "List all functions invoked in the script"),
// ztd::option("unset-var", false, "Add 'unset' to vars"), // ztd::option("unset-var", false, "Add 'unset' to vars"),
ztd::option("remove-unused", false, "Remove unused functions") ztd::option("remove-unused", false, "Remove unused functions")