uninstall --unused: Don't prompt if no unused refs found

If there was no refs found to delete, we don't want to print the "ok?" prompt.
Instead we just say that nothing was found.

Closes: #1776
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson
2018-06-11 10:55:36 +02:00
committed by Atomic Bot
parent 27fe8dd6a3
commit a123c858a5

View File

@@ -197,6 +197,8 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
}
else if (opt_unused)
{
gboolean found_something_to_uninstall = FALSE;
for (j = 0; j < dirs->len; j++)
{
FlatpakDir *dir = g_ptr_array_index (dirs, j);
@@ -287,9 +289,16 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
g_ptr_array_sort (udir->refs, flatpak_strcmp0_ptr);
for (i = 0; i < udir->refs->len; i++)
g_print (" %s\n", (char *)udir->refs->pdata[i]);
found_something_to_uninstall = TRUE;
}
}
if (!found_something_to_uninstall)
{
g_print (_("Nothing unused to uninstall\n"));
return TRUE;
}
if (!opt_yes &&
!flatpak_yes_no_prompt (_("Is this ok?")))
return TRUE;