From 68ac07080c14e7bea0408f3da7649c9b4b8896c7 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 14 Jun 2015 17:45:18 -0400 Subject: [PATCH] CLI2: ::findCommand now return a bool indicating what happened. --- src/CLI2.cpp | 9 ++++++--- src/CLI2.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 5eac6c0bd..307f366b6 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -944,7 +944,7 @@ void CLI2::findOverrides () } //////////////////////////////////////////////////////////////////////////////// -void CLI2::findCommand () +bool CLI2::findCommand () { for (auto& a : _args) { @@ -960,10 +960,13 @@ void CLI2::findCommand () if (context.config.getInteger ("debug.parser") >= 3) context.debug (dump ("CLI2::analyze findCommand")); - // Stop at first command. - break; + // Stop and indicate command found. + return true; } } + + // Indicate command not found. + return false; } /* diff --git a/src/CLI2.h b/src/CLI2.h index c49f5516f..b18f1bf72 100644 --- a/src/CLI2.h +++ b/src/CLI2.h @@ -113,7 +113,7 @@ private: void handleTerminator (); void aliasExpansion (); void findOverrides (); - void findCommand (); + bool findCommand (); /* void categorize (); */