@@ -223,6 +223,28 @@ int main()
223
223
fwprintf (stderr ,L"ERROR:Invalid Arguments\n" );
224
224
return 1 ;
225
225
}
226
+ else if (wcscmp (wargv [1 ],L"clean" ) == 0 )
227
+ {
228
+ char yn ;
229
+ wprintf (L"This will remove this distro (%s) from the filesystem.\n" ,TargetName );
230
+ wprintf (L"Are you sure you would like to proceed? (This cannot be undone)\n" );
231
+ wprintf (L"Type \"y\" to continue:" );
232
+ scanf ("%c" ,& yn );
233
+ if (yn == 'y' )
234
+ {
235
+ wprintf (L"Unregistering...\n" );
236
+ res = WslUnregisterDistribution (TargetName );
237
+ if (res != 0 )
238
+ {
239
+ fwprintf (stderr ,L"ERROR:Unregister Failed!\nHRESULT:0x%x\n" ,res );
240
+ return res ;
241
+ }
242
+ wprintf (L"Successfully removed distro." );
243
+ return 0 ;
244
+ }
245
+ fwprintf (stderr ,L"Accepting is required to proceed. Exiting..." );
246
+ return 1 ;
247
+ }
226
248
else if (wcscmp (wargv [1 ],L"help" ) == 0 )
227
249
{
228
250
show_usage ();
@@ -233,7 +255,6 @@ int main()
233
255
fwprintf (stderr ,L"ERROR:Invalid Arguments.\n" );
234
256
wprintf (L"\n" );
235
257
show_usage ();
236
-
237
258
return 1 ;
238
259
}
239
260
}
@@ -312,6 +333,8 @@ void show_usage()
312
333
wprintf (L" - `--append-path`: Get on/off status of Append Windows PATH to $PATH\n" );
313
334
wprintf (L" - `--mount-drive`: Get on/off status of Mount drives\n" );
314
335
wprintf (L" - `--lxuid`: Get LxUID key for this distro\n\n" );
336
+ wprintf (L" clean\n" );
337
+ wprintf (L" - Uninstalls the distro.\n\n" );
315
338
wprintf (L" help\n" );
316
339
wprintf (L" - Print this usage message.\n\n" );
317
340
0 commit comments