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

Support rsp in MTP #4072

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Youssef1313
Copy link
Member

Fixes #3730

@microsoft-github-policy-service microsoft-github-policy-service bot added Area: Testing Platform Belongs to the Microsoft.Testing.Platform core library Type: Discussion Type: Feature labels Nov 17, 2024
@Youssef1313 Youssef1313 force-pushed the support-rsp branch 5 times, most recently from 8ee8e46 to 41d38e8 Compare November 17, 2024 16:06
@Youssef1313 Youssef1313 marked this pull request as ready for review November 18, 2024 09:26
new("option4", ["d"]),
new("option5", ["e"]),
new("option6", ["f"]),
}.ToArray(), []));
Copy link
Contributor

Choose a reason for hiding this comment

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

pls add a pair of more sample with

  1. rsp file at the start
  2. rsp file t the end
  3. only rsp file
  4. 2 rsp file only

Copy link
Contributor

@MarcoRossignoli MarcoRossignoli left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

// - https://github.com/dotnet/command-line-api/blob/feb61c7f328a2401d74f4317b39d02126cfdfe24/src/System.CommandLine/Parsing/StringExtensions.cs#L349
internal static class ResponseFileHelper
{
internal static bool TryReadResponseFile(string rspFilePath, List<string> errors, [NotNullWhen(true)] out string[]? newArguments)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: let's use higher abstraction for errors.

Suggested change
internal static bool TryReadResponseFile(string rspFilePath, List<string> errors, [NotNullWhen(true)] out string[]? newArguments)
internal static bool TryReadResponseFile(string rspFilePath, ICollection<string> errors, [NotNullWhen(true)] out string[]? newArguments)

newArguments = null;
return false;

static IEnumerable<string> ExpandResponseFile(string filePath)
Copy link
Member

Choose a reason for hiding this comment

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

Stylistic nit:

Suggested change
static IEnumerable<string> ExpandResponseFile(string filePath)
// Local functions
static IEnumerable<string> ExpandResponseFile(string filePath)


static IEnumerable<string> ExpandResponseFile(string filePath)
{
string[] lines = File.ReadAllLines(filePath);
Copy link
Member

Choose a reason for hiding this comment

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

Could it be worth reading async (cc @MarcoRossignoli)?

}
catch (IOException e)
{
errors.Add(string.Format(CultureInfo.InvariantCulture, PlatformResources.CommandLineParserFailedToReadResponseFile, rspFilePath, e.Message));
Copy link
Member

Choose a reason for hiding this comment

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

It might be worth adding the tostring of the exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Testing Platform Belongs to the Microsoft.Testing.Platform core library Type: Discussion Type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support @response.rsp files
3 participants