Skip to content
New issue

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

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

Already on GitHub? # to your account

Revert "update System.CommandLine (#1356)", but keep the removal of two dependencies #1363

Merged
merged 2 commits into from
Feb 6, 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
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.25072.1">
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.23307.1">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha>
<Sha>02fe27cd6a9b001c8feb7938e6ef4b3799745759</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.607201">
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.430701">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha>
<Sha>02fe27cd6a9b001c8feb7938e6ef4b3799745759</Sha>
<SourceBuild RepoName="command-line-api" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- commandline -->
<SystemCommandLineVersion>2.0.0-beta4.25072.1</SystemCommandLineVersion>
<SystemCommandLineVersion>2.0.0-beta4.23307.1</SystemCommandLineVersion>
<!-- msbuild -->
<MicrosoftBuildVersion>17.8.3</MicrosoftBuildVersion>
<MicrosoftBuildTasksCoreVersion>17.8.3</MicrosoftBuildTasksCoreVersion>
Expand Down
24 changes: 12 additions & 12 deletions src/dotnet-sourcelink/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,42 +59,42 @@ private static string GetSourceLinkVersion()
return attribute.InformationalVersion.Split('+').First();
}

private static RootCommand GetRootCommand()
private static CliRootCommand GetRootCommand()
{
var pathArg = new Argument<string>("path")
var pathArg = new CliArgument<string>("path")
{
Description = "Path to an assembly or .pdb"
};
var authArg = new Option<string>("--auth", "-a")
var authArg = new CliOption<string>("--auth", "-a")
{
Description = "Authentication method"
};
authArg.AcceptOnlyFromAmong(AuthenticationMethod.Basic);

var authEncodingArg = new Option<Encoding>("--auth-encoding", "-e")
var authEncodingArg = new CliOption<Encoding>("--auth-encoding", "-e")
{
CustomParser = arg => Encoding.GetEncoding(arg.Tokens.Single().Value),
Description = "Encoding to use for authentication value"
};

var userArg = new Option<string>("--user", "-u")
var userArg = new CliOption<string>("--user", "-u")
{
Description = "Username to use to authenticate",
Arity = ArgumentArity.ExactlyOne
};

var passwordArg = new Option<string>("--password", "-p")
var passwordArg = new CliOption<string>("--password", "-p")
{
Description = "Password to use to authenticate",
Arity = ArgumentArity.ExactlyOne
};

var offlineArg = new Option<bool>("--offline")
var offlineArg = new CliOption<bool>("--offline")
{
Description = "Offline mode - skip validation of sourcelink URL targets"
};

var test = new Command("test", "TODO")
var test = new CliCommand("test", "TODO")
{
pathArg,
authArg,
Expand All @@ -116,25 +116,25 @@ private static RootCommand GetRootCommand()
return TestAsync(path, authMethod, authEncoding, user, password, offline, parseResult, cancellationToken);
});

var printJson = new Command("print-json", "Print Source Link JSON stored in the PDB")
var printJson = new CliCommand("print-json", "Print Source Link JSON stored in the PDB")
{
pathArg
};
printJson.SetAction((parseResult, ct) => PrintJsonAsync(parseResult.GetValue(pathArg)!, parseResult));

var printDocuments = new Command("print-documents", "TODO")
var printDocuments = new CliCommand("print-documents", "TODO")
{
pathArg
};
printDocuments.SetAction((parseResult, ct) => PrintDocumentsAsync(parseResult.GetValue(pathArg)!, parseResult));

var printUrls = new Command("print-urls", "TODO")
var printUrls = new CliCommand("print-urls", "TODO")
{
pathArg
};
printUrls.SetAction((parseResult, ct) => PrintUrlsAsync(parseResult.GetValue(pathArg)!, parseResult));

var root = new RootCommand()
var root = new CliRootCommand()
{
test,
printJson,
Expand Down