aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/qpdf/QPDFArgParser.hh7
-rw-r--r--libqpdf/QPDFJob_argv.cc10
2 files changed, 7 insertions, 10 deletions
diff --git a/include/qpdf/QPDFArgParser.hh b/include/qpdf/QPDFArgParser.hh
index e5b2c490..24e6ac48 100644
--- a/include/qpdf/QPDFArgParser.hh
+++ b/include/qpdf/QPDFArgParser.hh
@@ -150,6 +150,12 @@ class QPDFArgParser
QPDF_DLL
void insertCompletion(std::string const&);
+ // Throw a Usage exception with the given message. In completion
+ // mode, this just exits to prevent errors from partial commands
+ // or other error messages from messing up completion.
+ QPDF_DLL
+ void usage(std::string const& message);
+
private:
struct OptionEntry
{
@@ -174,7 +180,6 @@ class QPDFArgParser
void argCompletionBash();
void argCompletionZsh();
- void usage(std::string const& message);
void checkCompletion();
void handleArgFileArguments();
void handleBashArguments();
diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc
index aa2c8bf4..2e35bd74 100644
--- a/libqpdf/QPDFJob_argv.cc
+++ b/libqpdf/QPDFJob_argv.cc
@@ -2174,15 +2174,7 @@ ArgParser::argEndCopyAttachments()
void
ArgParser::usage(std::string const& message)
{
- if (this->ap.isCompleting())
- {
- // This will cause bash to fall back to regular file completion.
- exit(0);
- }
- else
- {
- throw QPDFArgParser::Usage(message);
- }
+ this->ap.usage(message);
}
std::vector<int>