aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-drop.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-09-15 15:01:48 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-09-16 13:03:06 +0300
commit564801acd608513adb07244829735ffb2669685d (patch)
tree9a28b539c5cd39954868452d2991f83e0db49b3f /bpkg/pkg-drop.cxx
parent11aea04f6499b5cdade754c89bc435d851c23679 (diff)
Don't prompt if build/drop plan is obvious
Diffstat (limited to 'bpkg/pkg-drop.cxx')
-rw-r--r--bpkg/pkg-drop.cxx24
1 files changed, 19 insertions, 5 deletions
diff --git a/bpkg/pkg-drop.cxx b/bpkg/pkg-drop.cxx
index d623b68..065d652 100644
--- a/bpkg/pkg-drop.cxx
+++ b/bpkg/pkg-drop.cxx
@@ -299,11 +299,12 @@ namespace bpkg
bool print_only,
bool disfigure_only,
bool yes,
- bool no)
+ bool no,
+ bool print_plan)
{
// Print what we are going to do, then ask for the user's confirmation.
//
- if (print_only || !(yes || no))
+ if (print_only || !(yes || no || !print_plan))
{
for (const drop_package& dp: pkgs)
{
@@ -328,7 +329,7 @@ namespace bpkg
// Ask the user if we should continue.
//
- if (no || !(yes || yn_prompt ("continue? [Y/n]", 'y')))
+ if (no || !(yes || !print_plan || yn_prompt ("continue? [Y/n]", 'y')))
return 1;
// All that's left to do is first disfigure configured packages and
@@ -433,6 +434,12 @@ namespace bpkg
//
drop_packages pkgs;
bool drop_prq (false);
+
+ // Print the plan and ask for the user's confirmation only if there are
+ // additional packages (such as dependents or prerequisites of the
+ // explicitly listed packages) to be dropped.
+ //
+ bool print_plan (false);
{
transaction t (db.begin ());
@@ -486,6 +493,8 @@ namespace bpkg
if (o.no () || !yn_prompt ("drop dependent packages? [y/N]", 'n'))
return 1;
+
+ print_plan = true;
}
// Collect all the prerequisites that are not held. These will be
@@ -541,6 +550,9 @@ namespace bpkg
}
drop_prq = yn_prompt ("drop prerequisite packages? [Y/n]", 'y');
+
+ if (drop_prq)
+ print_plan = true;
}
t.commit ();
@@ -554,7 +566,8 @@ namespace bpkg
o.print_only (),
o.disfigure_only (),
o.yes (),
- o.no ());
+ o.no (),
+ print_plan);
}
set<shared_ptr<selected_package>>
@@ -623,7 +636,8 @@ namespace bpkg
false, // Print-only (too late for that).
false, // Disfigure-only (could be an option).
true, // Yes (don't print the plan or prompt).
- false); // No (we already said yes).
+ false, // No (we already said yes).
+ false); // Don't print the plan (just to reiterate).
set<shared_ptr<selected_package>> r;
for (const drop_package& dp: pkgs)