Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display current repository path when using haxelib list #634

Open
wants to merge 11 commits into
base: development
Choose a base branch
from
Open
Binary file modified run.n
Binary file not shown.
2 changes: 1 addition & 1 deletion src/haxelib/api/Scope.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ abstract class Scope {
final overrides:LockFormat;

function new(isLocal:Bool, repository:Repository) {
this.isLocal = isLocal;
this.repository = repository;
this.isLocal = isLocal;

overrides = loadOverrides();
}
Expand Down
24 changes: 19 additions & 5 deletions src/haxelib/client/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -553,21 +553,35 @@ class Main {

// sort projects alphabetically
libraryInfo.sort(function(a, b) return Reflect.compare(a.name.toLowerCase(), b.name.toLowerCase()));


// we want to print in one batch, rather than one cli print for each line
var listStr = '';

if (scope.repository.path != RepoManager.suggestGlobalPath())
Cli.printOptional('Local Haxelib Repository at: ${scope.repository.path}');
else
Cli.printOptional('Global Haxelib at: ${scope.repository.path}');

for (library in libraryInfo) {
var line = '${library.name}:';
listStr += '${library.name}:';
for (version in library.versions)
line +=
listStr +=
if (library.devPath == null && version == library.current)
' [$version]'
else
' $version';

if (library.devPath != null)
line += ' [dev:${library.devPath}]';
listStr += ' [dev:${library.devPath}]';

listStr += "\n";

Cli.print(line);
}

listStr = listStr.trim();

Cli.print(listStr);

}

function update() {
Expand Down
2 changes: 1 addition & 1 deletion test/tests/integration/TestDev.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TestDev extends IntegrationTests {
final r = haxelib(["dev", "bar", Path.join([IntegrationTests.projectRoot, "test/libraries/libBar"])]).result();
assertSuccess(r);

final r = haxelib(["list", "Bar"]).result();
final r = haxelib(["list", "Bar", "--quiet"]).result();
assertTrue(r.out.startsWith("Bar"));
assertSuccess(r);
// even though the user used "bar", we show "Bar" as that is what is found in haxelib.json
Expand Down
2 changes: 1 addition & 1 deletion test/tests/integration/TestList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class TestList extends IntegrationTests {
function testInvalidDirectories():Void {
FileSystem.createDirectory('${projectRoot}$repo/LIBRARY');

final r = haxelib(["list"]).result();
final r = haxelib(["list", "--quiet"]).result();
assertSuccess(r);
// the command should not crash
assertEquals("", r.out);
Expand Down