use commandn everywhere
parent
7c5223ca19
commit
ef51bcb828
9
globs.cc
9
globs.cc
|
@ -11,6 +11,9 @@ using ostd::Vector;
|
|||
using ostd::String;
|
||||
using ostd::slice_until;
|
||||
|
||||
using cscript::CsState;
|
||||
using cscript::TvalRange;
|
||||
|
||||
static void ob_get_path_parts(
|
||||
Vector<ConstCharRange> &parts, ConstCharRange elem
|
||||
) {
|
||||
|
@ -171,9 +174,9 @@ static String ob_expand_globs(Vector<String> const &src) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void cs_register_globs(cscript::CsState &csv) {
|
||||
csv.add_command("glob", "C", [](cscript::CsState &cs, ConstCharRange lst) {
|
||||
auto fnames = cscript::util::list_explode(lst);
|
||||
void cs_register_globs(CsState &csv) {
|
||||
csv.add_commandn("glob", "C", [](CsState &cs, TvalRange args) {
|
||||
auto fnames = cscript::util::list_explode(args[0].get_strr());
|
||||
cs.result->set_str(ob_expand_globs(fnames).disown());
|
||||
});
|
||||
}
|
||||
|
|
4
main.cc
4
main.cc
|
@ -571,10 +571,10 @@ int main(int argc, char **argv) {
|
|||
|
||||
osv.register_rulecmds();
|
||||
|
||||
osv.add_command("shell", "C", [](ObState &os, ConstCharRange s) {
|
||||
osv.add_commandn("shell", "C", [](ObState &os, TvalRange args) {
|
||||
auto cnt = os.counters.back();
|
||||
cnt->incr();
|
||||
tpool.push([cnt, ds = String(s)]() {
|
||||
tpool.push([cnt, ds = String(args[0].get_strr())]() {
|
||||
int ret = system(ds.data());
|
||||
if (ret && !cnt->result) {
|
||||
cnt->result = ret;
|
||||
|
|
Loading…
Reference in New Issue