improve the duprule command

master
Daniel Kolesa 2015-11-20 16:49:23 +00:00
parent 077460f53c
commit b3bf83dfc5
1 changed files with 5 additions and 5 deletions

10
main.cc
View File

@ -339,8 +339,7 @@ struct ObState {
r.target = tgt;
r.action = oldr->action;
r.func = oldr->func;
r.deps = dep ? cscript::util::list_explode(dep)
: ostd::Vector<ostd::String>();
r.deps = dep ? cscript::util::list_explode(dep) : oldr->deps;
}
};
@ -442,9 +441,10 @@ int main(int argc, char **argv) {
((ObState &)cs).rule_add(file, deps, nullptr);
});
os.cs.add_command("duprule", "sss", [](CsState &cs, const char *tgt,
const char *ptgt, const char *dep) {
((ObState &)cs).rule_dup(tgt, ptgt, dep);
os.cs.add_command("duprule", "sssN", [](CsState &cs, const char *tgt,
const char *ptgt, const char *dep,
int *numargs) {
((ObState &)cs).rule_dup(tgt, ptgt, (*numargs > 2) ? dep : nullptr);
});
os.cs.add_commandn("getenv", "ss", [](CsState &cs, TvalRange args) {