diff --git a/source/dub/commandline.d b/source/dub/commandline.d index 96c1c8c..bbedda3 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -122,15 +122,6 @@ return 0; } - // initialize DUB - auto package_suppliers = registry_urls.map!(url => cast(PackageSupplier)new RegistryPackageSupplier(Url(url))).array; - Dub dub = new Dub(package_suppliers, root_path); - - // make the CWD package available so that for example sub packages can reference their - // parent package. - try dub.packageManager.getTemporaryPackage(Path(root_path), Version("~master")); - catch (Exception e) { logDiagnostic("No package found in current working directory."); } - // execute the sepected command foreach (cmd; commands) if (cmd.name == cmdname) { @@ -149,6 +140,15 @@ return 0; } + // initialize DUB + auto package_suppliers = registry_urls.map!(url => cast(PackageSupplier)new RegistryPackageSupplier(Url(url))).array; + Dub dub = new Dub(package_suppliers, root_path); + + // make the CWD package available so that for example sub packages can reference their + // parent package. + try dub.packageManager.getTemporaryPackage(Path(root_path), Version("~master")); + catch (Exception e) { logDiagnostic("No package found in current working directory."); } + try return cmd.execute(dub, command_args.extractRemainingArgs(), app_args); catch (UsageException e) { logError("%s", e.msg);