44using System ;
55using System . Collections . Generic ;
66using System . CommandLine ;
7- using System . CommandLine . Help ;
87using System . Threading ;
98using System . Threading . Tasks ;
109
@@ -16,60 +15,50 @@ internal static void Register(Command packageCommand, Option<bool> interactiveOp
1615 {
1716 Register ( packageCommand , interactiveOption , PackageDownloadRunner . RunAsync ) ;
1817 }
18+
1919 public static void Register ( Command packageCommand , Option < bool > interactiveOption , Func < PackageDownloadArgs , CancellationToken , Task < int > > action )
2020 {
2121 var downloadCommand = new DocumentedCommand (
2222 "download" ,
23- Strings . pkgDownload_descritpion ,
23+ Strings . PackageDownloadCommand_descritpion ,
2424 "https://aka.ms/dotnet/package/download" ) ;
2525
2626 // Arguments
27- var packagesArguments = new Argument < IReadOnlyList < Package > > ( "packages" )
27+ var packagesArguments = new Argument < IReadOnlyList < PackageWithNuGetVersion > > ( "packages" )
2828 {
2929 Description = Strings . PackageUpdate_PackageArgumentDescription ,
30- Arity = ArgumentArity . ZeroOrMore ,
31- CustomParser = Package . Parse
30+ Arity = ArgumentArity . OneOrMore ,
31+ CustomParser = PackageWithNuGetVersion . Parse
3232 } ;
3333
3434 // Options
3535 var allowInsecureConnections = new Option < bool > ( "--allow-insecure-connections" )
3636 {
37- Description = Strings . pkgDownload_AllowInsecureConnectionsDescritption ,
37+ Description = Strings . PackageDownloadCommand_AllowInsecureConnectionsDescritption ,
3838 Arity = ArgumentArity . Zero
3939 } ;
4040
4141 var configFile = new Option < string > ( "--configfile" )
4242 {
43- Description = Strings . pkgDownload_configFileDesciption ,
43+ Description = Strings . Option_ConfigFile ,
4444 Arity = ArgumentArity . ExactlyOne
4545 } ;
4646
47- var downloadOnly = new Option < bool > ( "--download-only" )
48- {
49- Description = Strings . pkgDownload_downloadOnlyDeciption ,
50- Arity = ArgumentArity . Zero
51- } ;
52-
53- var help = new HelpOption ( )
54- {
55- Arity = ArgumentArity . Zero
56- } ;
57-
58- var outputDirectory = new Option < string > ( "--output-directory" )
47+ var outputDirectory = new Option < string > ( "--output" , "-o" )
5948 {
60- Description = Strings . pkgDownload_OutputDirectoryDescription ,
49+ Description = Strings . PackageDownloadCommand_OutputDirectoryDescription ,
6150 Arity = ArgumentArity . ExactlyOne
6251 } ;
6352
6453 var prerelease = new Option < bool > ( "--prerelease" )
6554 {
66- Description = Strings . pkgDownload_prereleaseDescription ,
55+ Description = Strings . Prerelease_Description ,
6756 Arity = ArgumentArity . Zero
6857 } ;
6958
70- var sources = new Option < List < string > > ( "--source" )
59+ var sources = new Option < List < string > > ( "--source" , "-s" )
7160 {
72- Description = Strings . pkgDownload_sourcesDescription ,
61+ Description = Strings . PackageDownloadCommand_SourcesDescription ,
7362 Arity = ArgumentArity . OneOrMore
7463 } ;
7564
@@ -79,8 +68,6 @@ public static void Register(Command packageCommand, Option<bool> interactiveOpti
7968 downloadCommand . Arguments . Add ( packagesArguments ) ;
8069 downloadCommand . Options . Add ( allowInsecureConnections ) ;
8170 downloadCommand . Options . Add ( configFile ) ;
82- downloadCommand . Options . Add ( downloadOnly ) ;
83- downloadCommand . Options . Add ( help ) ;
8471 downloadCommand . Options . Add ( interactiveOption ) ;
8572 downloadCommand . Options . Add ( outputDirectory ) ;
8673 downloadCommand . Options . Add ( prerelease ) ;
@@ -89,14 +76,13 @@ public static void Register(Command packageCommand, Option<bool> interactiveOpti
8976
9077 downloadCommand . SetAction ( async ( parserResult , cancellationToken ) =>
9178 {
92- IReadOnlyList < Package > packages = parserResult . GetValue ( packagesArguments ) ?? [ ] ;
79+ IReadOnlyList < PackageWithNuGetVersion > packages = parserResult . GetValue ( packagesArguments ) ?? [ ] ;
9380 var args = new PackageDownloadArgs ( )
9481 {
9582 Packages = packages ,
9683 Sources = parserResult . GetValue ( sources ) ,
9784 OutputDirectory = parserResult . GetValue ( outputDirectory ) ,
9885 IncludePrerelease = parserResult . GetValue ( prerelease ) ,
99- DownloadOnly = parserResult . GetValue ( downloadOnly ) ,
10086 AllowInsecureConnections = parserResult . GetValue ( allowInsecureConnections ) ,
10187 Interactive = parserResult . GetValue ( interactiveOption ) ,
10288 ConfigFile = parserResult . GetValue ( configFile ) ,
0 commit comments