Merge pull request #866 from dlang/issue856-shebang-args
Pass all remaining args to the script for "dub [file].d" invocations.
commit b02c18991b0cb4627eb0c943efd6ca3e69192751
2 parents a373163 + 90299db
@Sönke Ludwig Sönke Ludwig authored on 8 Jun 2016
Showing 3 changed files
View
6
source/dub/commandline.d
args = common_args.extractRemainingArgs();
if (args.length >= 1 && !args[0].startsWith("-")) {
if (args[0].endsWith(".d")) {
cmdname = "run";
args = "--single" ~ args;
if (app_args.length) app_args = args[1 .. $] ~ "--" ~ app_args;
else app_args = args[1 .. $];
args = ["--single", args[0]];
} else {
cmdname = args[0];
args = args[1 .. $];
}
View
3
■■
test/issue103-single-file-package.d
name "hello_world"
+/
module hello;
 
void main()
void main(string[] args)
{
import std.stdio : writeln;
assert(args.length == 4 && args[1 .. 4] == ["foo", "--", "bar"]);
writeln("Hello, World!");
}
View
2
■■■
test/issue103-single-file-package.sh
#!/bin/sh
set -e
cd ${CURR_DIR}
./issue103-single-file-package.d
./issue103-single-file-package.d foo -- bar
${DUB} run --single issue103-single-file-package-json.d --compiler=${DC}
${DUB} issue103-single-file-package-w-dep.d --compiler=${DC}