Skip to content

Commit

Permalink
Trivial: Document and improve Dub.runCustomInitialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 authored and dlang-bot committed Jan 9, 2024
1 parent 8faab63 commit 96f495b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions source/dub/dub.d
Original file line number Diff line number Diff line change
Expand Up @@ -1279,13 +1279,18 @@ class Dub {
logInfo("Success", Color.green, "created empty project in %s", path.toNativeString().color(Mode.bold));
}

private void runCustomInitialization(NativePath path, string type, string[] runArgs)
/**
* Run initialization code from a template project
*
* Looks up a project, then get its `init-exec` subpackage,
* and run this to initialize the repository with a default structure.
*/
private void runCustomInitialization(NativePath path, string name, string[] runArgs)
{
string packageName = type;
auto template_pack = m_packageManager.getBestPackage(packageName);
auto template_pack = m_packageManager.getBestPackage(name);
if (!template_pack) {
logInfo("%s is not present, getting and storing it user wide", packageName);
template_pack = fetch(packageName, VersionRange.Any, defaultPlacementLocation, FetchOptions.none);
logInfo("%s is not present, getting and storing it user wide", name);
template_pack = fetch(name, VersionRange.Any, defaultPlacementLocation, FetchOptions.none);
}

Package initSubPackage = m_packageManager.getSubPackage(template_pack, "init-exec", false);
Expand Down

0 comments on commit 96f495b

Please sign in to comment.