Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Show all packages that are to be installed #35

Merged
merged 4 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/moss/client/cli/install.d
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import std.file : exists;
auto candidates = cl.registry.byProvider(search.type, search.target);
if (candidates.empty)
{
errorf("Cannot find package %s", item);
error(format!"Cannot find package %s"(item));
return 1;
}
auto chosen = candidates.front;
Expand All @@ -96,7 +96,8 @@ import std.file : exists;
}
return 1;
}
cl.ui.inform("The following packages will be installed\n");
cl.ui.inform!"The following %d %s will be installed\n"
(result.length, result.length == 1 ? "package" : "packages");
auto newPkgs = result.filter!((p) => !p.installed);
cl.ui.emitAsColumns(newPkgs);
cl.ui.inform("");
Expand Down
4 changes: 2 additions & 2 deletions source/moss/client/ui.d
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ public final class UserInterface
auto workset = displayable.array;
workset.sort!"a.toString < b.toString";

/* Ensure small sets go multiline */
auto colHeight = max(workset.length / nColumns, 1);
/* Ensure small sets go multiline. Use max() to avoid integer overflow */
auto colHeight = ((max(workset.length, 1) - 1) / nColumns) + 1;
if (workset.length > nColumns && colHeight == 1)
{
colHeight++;
Expand Down