diff --git a/source/dub/commandline.d b/source/dub/commandline.d index d75b235..f4c5fd6 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -122,9 +122,10 @@ // extract the command string cmdname; args = common_args.extractRemainingArgs(); - if (args.length >= 1 && !args[0].startsWith("-")) { - cmdname = args[0]; - args = args[1 .. $]; + auto cmdidx = args.countUntil!(a => !a.startsWith("-")); + if (cmdidx >= 0) { + cmdname = args[cmdidx]; + args = args[0 .. cmdidx] ~ args[cmdidx+1 .. $]; } else { if (help) { showHelp(commands, common_args);