From e6f10cabb7fbdba6fd11bcd109dbe765285c762c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 22 Oct 2015 11:07:03 +0200 Subject: Implement dependents check in drop command Also, add support for commands to return program status. --- bpkg/bpkg.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bpkg/bpkg.cxx') diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx index 61f7425..6246d6f 100644 --- a/bpkg/bpkg.cxx +++ b/bpkg/bpkg.cxx @@ -145,6 +145,7 @@ try // Handle commands. // + int r (1); for (;;) { // help @@ -152,7 +153,7 @@ try if (cmd.help ()) { assert (h); - help (ho, "help", help_options::print_usage); + r = help (ho, "help", help_options::print_usage); break; } @@ -163,7 +164,7 @@ try // if (h) // help (ho, "pkg-verify", pkg_verify_options::print_usage); // else - // pkg_verify (parse (co, args), args); + // r = pkg_verify (parse (co, args), args); // // return 0; // } @@ -174,7 +175,7 @@ try if (h) \ help (ho, SP#CMD, NP##CMD##_options::print_usage); \ else \ - NP##CMD (parse (co, args), args); \ + r = NP##CMD (parse (co, args), args); \ \ break; \ } @@ -219,6 +220,9 @@ try fail << "unhandled command"; } + if (r != 0) + return r; + // Warn if args contain some leftover junk. We already successfully // performed the command so failing would probably be misleading. // -- cgit v1.1