8000 Add default for dotnet reference list Fixes #48555 by Forgind · Pull Request #48825 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

Add default for dotnet reference list Fixes #48555 #48825

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

Merged
merged 2 commits into from
May 13, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private static Command ConstructCommand()
}
else
{
return new PackageAddCommand(parseResult, parseResult.GetValue(AddCommandParser.ProjectArgument)).Execute();
return new PackageAddCommand(parseResult, parseResult.GetValue(AddCommandParser.ProjectArgument) ?? Directory.GetCurrentDirectory()).Execute();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public ReferenceListCommand(

_fileOrDirectory = parseResult.HasOption(ReferenceCommandParser.ProjectOption) ?
parseResult.GetValue(ReferenceCommandParser.ProjectOption) :
parseResult.GetValue(ListCommandParser.SlnOrProjectArgument);
parseResult.GetValue(ListCommandParser.SlnOrProjectArgument) ??
Directory.GetCurrentDirectory();
Copy link
Preview
Copilot AI May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider explicitly handling directory formatting (e.g., trailing DirectorySeparatorChar) when defaulting to Directory.GetCurrentDirectory() to maintain consistency with file path expectations.

Suggested change
Directory.GetCurrentDirectory();
(Directory.GetCurrentDirectory().EndsWith(Path.DirectorySeparatorChar)
? Directory.GetCurrentDirectory()
: Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar);

Copilot uses AI. Check for mistakes.

}

public override int Execute()
Expand Down
0