Skip to content
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
Expand Up @@ -138,9 +138,9 @@
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.512601">
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.607201">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>5ea97af07263ea3ef68a18557c8aa3f7e3200bda</Sha>
<Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha>
<SourceBuild RepoName="command-line-api" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
Expand Down Expand Up @@ -178,9 +178,9 @@
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>990ebf52fc408ca45929fd176d2740675a67fab8</Sha>
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.24126.1">
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.25072.1">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>5ea97af07263ea3ef68a18557c8aa3f7e3200bda</Sha>
<Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha>
</Dependency>
<!-- Transitive dependency needed for source build. -->
<Dependency Name="System.Reflection.Metadata" Version="9.0.0-rc.2.24473.5">
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<MicrosoftDotNetProductConstructionServiceClientVersion>1.1.0-beta.25074.4</MicrosoftDotNetProductConstructionServiceClientVersion>
<MicrosoftDotNetMaestroTasksVersion>1.1.0-beta.25074.4</MicrosoftDotNetMaestroTasksVersion>
<!-- command-line-api -->
<SystemCommandLineVersion>2.0.0-beta4.24126.1</SystemCommandLineVersion>
<SystemCommandLineVersion>2.0.0-beta4.25072.1</SystemCommandLineVersion>
<!-- corefx -->
<MicrosoftBclHashCodeVersion>1.1.1</MicrosoftBclHashCodeVersion>
<SystemMemoryVersion Condition="'$(DotNetBuildSourceOnly)' != 'true'">4.5.5</SystemMemoryVersion>
Expand Down
30 changes: 15 additions & 15 deletions src/Microsoft.DotNet.MacOsPkg/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ public static int Main(string[] args)
return 1;
}

CliRootCommand rootCommand = Setup();
return new CliConfiguration(rootCommand).Invoke(args);
RootCommand rootCommand = Setup();
return new CommandLineConfiguration(rootCommand).Invoke(args);
}

/// <summary>
/// Set up the command line interface and associated actions.
/// </summary>
/// <returns>Root cli command</returns>
private static CliRootCommand Setup()
private static RootCommand Setup()
{
var rootCommand = new CliRootCommand();
var unpackSrcArgument = new CliArgument<string>("src") { Description = "Source path of the .pkg or .app file" };
var unpackDestinationArgument = new CliArgument<string>("dst") { Description = "Destination path to unpack the file" };
var unpackCommand = new CliCommand("unpack", "Unpack a .pkg or .app file")
var rootCommand = new RootCommand();
var unpackSrcArgument = new Argument<string>("src") { Description = "Source path of the .pkg or .app file" };
var unpackDestinationArgument = new Argument<string>("dst") { Description = "Destination path to unpack the file" };
var unpackCommand = new Command("unpack", "Unpack a .pkg or .app file")
{
Arguments = { unpackSrcArgument, unpackDestinationArgument }
};
Expand All @@ -48,9 +48,9 @@ private static CliRootCommand Setup()
return UnpackCommand(result, unpackSrcArgument, unpackDestinationArgument);
});

var packSrcArgument = new CliArgument<string>("src") { Description = "Source path to pack." };
var packDstArgument = new CliArgument<string>("dst") { Description = "Destination path of the .pkg or .app file." };
var packCommand = new CliCommand("pack", "Pack a directory into a .pkg or .app file.")
var packSrcArgument = new Argument<string>("src") { Description = "Source path to pack." };
var packDstArgument = new Argument<string>("dst") { Description = "Destination path of the .pkg or .app file." };
var packCommand = new Command("pack", "Pack a directory into a .pkg or .app file.")
{
Arguments = { packSrcArgument, packDstArgument }
};
Expand All @@ -59,8 +59,8 @@ private static CliRootCommand Setup()
return PackCommand(result, packSrcArgument, packDstArgument);
});

var pkgOrAppArgument = new CliArgument<string>("src") { Description = "Input pkg or app to verify." };
var verifyCommand = new CliCommand("verify", "Verify that a pkg or app is signed.")
var pkgOrAppArgument = new Argument<string>("src") { Description = "Input pkg or app to verify." };
var verifyCommand = new Command("verify", "Verify that a pkg or app is signed.")
{
Arguments = { pkgOrAppArgument }
};
Expand All @@ -75,7 +75,7 @@ private static CliRootCommand Setup()
return rootCommand;
}

private static int VerifyCommand(ParseResult result, CliArgument<string> pkgOrAppArgument)
private static int VerifyCommand(ParseResult result, Argument<string> pkgOrAppArgument)
{
var srcPath = result.GetValue(pkgOrAppArgument) ?? throw new Exception("src must be non-empty");
try
Expand Down Expand Up @@ -103,7 +103,7 @@ private static int VerifyCommand(ParseResult result, CliArgument<string> pkgOrAp
return 0;
}

private static int PackCommand(ParseResult result, CliArgument<string> packSrcArgument, CliArgument<string> packDstArgument)
private static int PackCommand(ParseResult result, Argument<string> packSrcArgument, Argument<string> packDstArgument)
{
var srcPath = result.GetValue(packSrcArgument) ?? throw new Exception("src must be non-empty");
var dstPath = result.GetValue(packDstArgument) ?? throw new Exception("dst must be non-empty");
Expand Down Expand Up @@ -141,7 +141,7 @@ private static int PackCommand(ParseResult result, CliArgument<string> packSrcAr
return 0;
}

private static int UnpackCommand(ParseResult result, CliArgument<string> unpackSrcArgument, CliArgument<string> unpackDestinationArgument)
private static int UnpackCommand(ParseResult result, Argument<string> unpackSrcArgument, Argument<string> unpackDestinationArgument)
{
var srcPath = result.GetValue(unpackSrcArgument) ?? throw new Exception("src must be non-empty");
var dstPath = result.GetValue(unpackDestinationArgument) ?? throw new Exception("dst must be non-empty");
Expand Down
12 changes: 6 additions & 6 deletions src/VersionTools/Microsoft.DotNet.VersionTools.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ static int Main(string[] args)
{
//// Global options

CliRootCommand rootCommand = new("Microsoft.DotNet.VersionTools.Cli v" + Environment.Version.ToString(2))
RootCommand rootCommand = new("Microsoft.DotNet.VersionTools.Cli v" + Environment.Version.ToString(2))
{
TreatUnmatchedTokensAsErrors = true
};

// Package command
CliOption<string> assetsDirectoryOption = new("--assets-path", "-d")
Option<string> assetsDirectoryOption = new("--assets-path", "-d")
{
Description = "Path to the directory where the assets are located",
Required = true
};

CliOption<string> searchPatternOption = new("--search-pattern", "-s")
Option<string> searchPatternOption = new("--search-pattern", "-s")
{
Description = "The search string to match against the names of subdirectories in --assets-path. See Directory.GetFiles for details.",
DefaultValueFactory = _ => "*.nupkg"
};

CliOption<bool> recursiveOption = new("--recursive", "-r")
Option<bool> recursiveOption = new("--recursive", "-r")
{
Description = "Search for assets recursively.",
DefaultValueFactory = _ => true
};

CliCommand trimAssetVersionCommand = new("trim-assets-version", "Trim versions from provided assets. Currently, only NuGet packages are supported.");
Command trimAssetVersionCommand = new("trim-assets-version", "Trim versions from provided assets. Currently, only NuGet packages are supported.");
trimAssetVersionCommand.Options.Add(assetsDirectoryOption);
trimAssetVersionCommand.Options.Add(searchPatternOption);
trimAssetVersionCommand.Options.Add(recursiveOption);
Expand All @@ -59,6 +59,6 @@ static int Main(string[] args)
});

rootCommand.Subcommands.Add(trimAssetVersionCommand);
return new CliConfiguration(rootCommand).Invoke(args);
return new CommandLineConfiguration(rootCommand).Invoke(args);
}
}
Loading