File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -278,9 +278,16 @@ const struct arg_chr arg_chars2[] = {
278
278
}
279
279
else {
280
280
// script filename
281
- rargs -> script = arg ;
282
- // after having processed a command-line argument as scriptname,
283
- // all remaining arguments are passed as-is to the script (via system/options/args)
281
+ if (rargs -> script ) {
282
+ // we already have the script from --script option
283
+ // so this should be first arg instead.
284
+ -- i ; // revert the counter so this value is collected later
285
+ }
286
+ else {
287
+ rargs -> script = arg ;
288
+ // after having processed a command-line argument as scriptname,
289
+ // all remaining arguments are passed as-is to the script (via system/options/args)
290
+ }
284
291
break ;
285
292
}
286
293
}
Original file line number Diff line number Diff line change @@ -54,8 +54,14 @@ rebol-cmd: func[cmd][
54
54
--assert out-buffer = {["-v" "--" "-x"]^/ ["-v" "--" "-x"]^/ }
55
55
--assert 0 = rebol-cmd {--args "a b" units/files/print-args.r3 -v}
56
56
--assert out-buffer = {["a b" "-v"]^/ ["a b"]^/ }
57
+ ; providing script using --script option
58
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/2469
57
59
--assert 0 = rebol-cmd {--script units/files/print-args.r3 --args "a b" -- -v}
58
60
--assert out-buffer = {["a b" "-v"]^/ ["a b"]^/ }
61
+ --assert 0 = rebol-cmd {--script units/files/print-args.r3 1 2}
62
+ --assert out-buffer = {["1" "2"]^/ ["1" "2"]^/ }
63
+ --assert 0 = rebol-cmd {--args 1 --script units/files/print-args.r3 2}
64
+ --assert out-buffer = {["1" "2"]^/ ["1"]^/ }
59
65
--test-- "script args 3"
60
66
;@@ https://github.com/Oldes/Rebol-issues/issues/2140
61
67
cmd: "units/files/print-args.r3"
You can’t perform that action at this time.
0 commit comments