forked from OctaForge/OctaBuild
add -e to execute strings
parent
5d0583d47f
commit
88c2656862
9
main.cc
9
main.cc
|
@ -265,7 +265,8 @@ static int ob_print_help(ConstCharRange a0, ostd::Stream &os, int v) {
|
||||||
" -C DIRECTORY\tChange to DIRECTORY before running.\n",
|
" -C DIRECTORY\tChange to DIRECTORY before running.\n",
|
||||||
" -f FILE\tSpecify the file to run (default: cubefile).\n"
|
" -f FILE\tSpecify the file to run (default: cubefile).\n"
|
||||||
" -h\t\tPrint this message.\n"
|
" -h\t\tPrint this message.\n"
|
||||||
" -j N\t\tSpecify the number of jobs to use (default: 1).");
|
" -j N\t\tSpecify the number of jobs to use (default: 1).\n"
|
||||||
|
" -e STR\t\tEvaluate a string instead of a file.");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +287,7 @@ int main(int argc, char **argv) {
|
||||||
cscript::init_lib_list(os.cs);
|
cscript::init_lib_list(os.cs);
|
||||||
|
|
||||||
ConstCharRange fname = "cubefile";
|
ConstCharRange fname = "cubefile";
|
||||||
|
ConstCharRange fcont;
|
||||||
|
|
||||||
int ac;
|
int ac;
|
||||||
while ((ac = getopt(argc, argv, "C:f:hj:")) >= 0) {
|
while ((ac = getopt(argc, argv, "C:f:hj:")) >= 0) {
|
||||||
|
@ -297,6 +299,9 @@ int main(int argc, char **argv) {
|
||||||
case 'f':
|
case 'f':
|
||||||
fname = optarg;
|
fname = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'e':
|
||||||
|
fcont = optarg;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
return ob_print_help(argv[0], ostd::out, 0);
|
return ob_print_help(argv[0], ostd::out, 0);
|
||||||
case 'j':
|
case 'j':
|
||||||
|
@ -343,7 +348,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
cs_register_globs(os.cs);
|
cs_register_globs(os.cs);
|
||||||
|
|
||||||
if (!os.cs.run_file(fname))
|
if ((!fcont.empty() && !os.cs.run_bool(fcont)) || !os.cs.run_file(fname))
|
||||||
return os.error(1, "failed creating rules");
|
return os.error(1, "failed creating rules");
|
||||||
|
|
||||||
if (rules.empty())
|
if (rules.empty())
|
||||||
|
|
Loading…
Reference in New Issue