@@ -48,6 +48,11 @@ public UpdateCommand(IHostEnvironment environment, bool throwOnUnexpectedArg = t
48
48
/// <remarks>Needs the full library id.</remarks>
49
49
public CommandOption ToVersion { get ; private set ; }
50
50
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
+
51
56
public override BaseCommand Configure ( CommandLineApplication parent = null )
52
57
{
53
58
base . Configure ( parent ) ;
@@ -56,6 +61,7 @@ public override BaseCommand Configure(CommandLineApplication parent = null)
56
61
Provider = Option ( "--provider|-p" , Resources . Text . UpdateCommandProviderOptionDesc , CommandOptionType . SingleValue ) ;
57
62
PreRelease = Option ( "--pre" , Resources . Text . UpdateCommandPreReleaseOptionDesc , CommandOptionType . NoValue ) ;
58
63
ToVersion = Option ( "--to" , Resources . Text . UpdateCommandToVersionOptionDesc , CommandOptionType . SingleValue ) ;
64
+ WhatIf = Option ( "--whatif" , Resources . Text . WhatIfOptionDesc , CommandOptionType . NoValue ) ;
59
65
60
66
// Reserve this.
61
67
Provider . ShowInHelpText = false ;
@@ -106,6 +112,12 @@ protected override async Task<int> ExecuteInternalAsync()
106
112
return 0 ;
107
113
}
108
114
115
+ if ( WhatIf . HasValue ( ) )
116
+ {
117
+ Logger . Log ( string . Format ( Resources . Text . WhatIfOutputMessage , libraryToUpdate . Name , newVersion ) , LogLevel . Operation ) ;
118
+ return 0 ;
119
+ }
120
+
109
121
Manifest backup = manifest . Clone ( ) ;
110
122
string oldLibraryName = libraryToUpdate . Name ;
111
123
Manifest . UpdateLibraryVersion ( libraryToUpdate , newVersion ) ;
0 commit comments