Skip to content

Commit

Permalink
Revert "update System.CommandLine (#1356)", but keep the removal of t…
Browse files Browse the repository at this point in the history
…wo dependencies (#1363)

* Revert "update System.CommandLine (#1356)"

This reverts commit 3c34adc.

* remove the dependencies to System.CommandLine.Rendering and System.CommandLine.NamingConventionBinder
  • Loading branch information
adamsitnik authored Feb 6, 2025
1 parent 8286783 commit 3ce7edb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
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

0 comments on commit 3ce7edb

Please sign in to comment.