@@ -48,6 +48,11 @@ public UpdateCommand(IHostEnvironment environment, bool throwOnUnexpectedArg = t
4848 /// <remarks>Needs the full library id.</remarks>
4949 public CommandOption ToVersion { get ; private set ; }
5050
51+ /// <summary>
52+ /// Option to specify if this should print the operation that would be carried out, but not make changes.
53+ /// </summary>
54+ public CommandOption WhatIf { get ; private set ; }
55+
5156 public override BaseCommand Configure ( CommandLineApplication parent = null )
5257 {
5358 base . Configure ( parent ) ;
@@ -56,6 +61,7 @@ public override BaseCommand Configure(CommandLineApplication parent = null)
5661 Provider = Option ( "--provider|-p" , Resources . Text . UpdateCommandProviderOptionDesc , CommandOptionType . SingleValue ) ;
5762 PreRelease = Option ( "--pre" , Resources . Text . UpdateCommandPreReleaseOptionDesc , CommandOptionType . NoValue ) ;
5863 ToVersion = Option ( "--to" , Resources . Text . UpdateCommandToVersionOptionDesc , CommandOptionType . SingleValue ) ;
64+ WhatIf = Option ( "--whatif" , Resources . Text . WhatIfOptionDesc , CommandOptionType . NoValue ) ;
5965
6066 // Reserve this.
6167 Provider . ShowInHelpText = false ;
@@ -106,6 +112,12 @@ protected override async Task<int> ExecuteInternalAsync()
106112 return 0 ;
107113 }
108114
115+ if ( WhatIf . HasValue ( ) )
116+ {
117+ Logger . Log ( string . Format ( Resources . Text . WhatIfOutputMessage , libraryToUpdate . Name , newVersion ) , LogLevel . Operation ) ;
118+ return 0 ;
119+ }
120+
109121 Manifest backup = manifest . Clone ( ) ;
110122 string oldLibraryName = libraryToUpdate . Name ;
111123 Manifest . UpdateLibraryVersion ( libraryToUpdate , newVersion ) ;
0 commit comments