diff --git a/Applications/CLI/CommandLineArgumentParser.cpp b/Applications/CLI/CommandLineArgumentParser.cpp
index 17c4f7ce77cf28cb61606f4060a74c87a0334486..950c57f0e2b40505b25deeb34c8dea98ce8e627d 100644
--- a/Applications/CLI/CommandLineArgumentParser.cpp
+++ b/Applications/CLI/CommandLineArgumentParser.cpp
@@ -18,7 +18,8 @@
 #include "InfoLib/CMakeInfo.h"
 #include "InfoLib/GitInfo.h"
 
-CommandLineArgumentParser::CommandLineArgumentParser(int argc, char* argv[])
+CommandLineArguments parseCommandLineArguments(int argc, char* argv[],
+                                               bool const exit_on_exception)
 {
     // Parse CLI arguments.
     TCLAP::CmdLine cmd(
@@ -35,6 +36,8 @@ CommandLineArgumentParser::CommandLineArgumentParser(int argc, char* argv[])
         GitInfoLib::GitInfo::ogs_version + "\n\n" +
             "CMake arguments: " + CMakeInfoLib::CMakeInfo::cmake_args);
 
+    cmd.setExceptionHandling(exit_on_exception);
+
     TCLAP::ValueArg<std::string> log_level_arg(
         "l", "log-level",
         "the verbosity of logging messages: none, error, warn, info, "
@@ -109,19 +112,21 @@ CommandLineArgumentParser::CommandLineArgumentParser(int argc, char* argv[])
 
     cmd.parse(argc, argv);
 
-    reference_path = reference_path_arg.getValue();
-    reference_path_is_set = reference_path_arg.isSet();
-    project = project_arg.getValue();
+    CommandLineArguments cli_args;
+    cli_args.reference_path = reference_path_arg.getValue();
+    cli_args.reference_path_is_set = reference_path_arg.isSet();
+    cli_args.project = project_arg.getValue();
 
-    BaseLib::setProjectDirectory(BaseLib::extractPath(project));
+    BaseLib::setProjectDirectory(BaseLib::extractPath(cli_args.project));
 
-    xml_patch_file_names = xml_patch_files_arg.getValue();
-    outdir = outdir_arg.getValue();
-    mesh_dir = mesh_dir_arg.getValue().empty() ? BaseLib::getProjectDirectory()
-                                               : mesh_dir_arg.getValue();
-    nonfatal = nonfatal_arg.getValue();
-    log_level = log_level_arg.getValue();
-    write_prj = write_prj_arg.getValue();
+    cli_args.xml_patch_file_names = xml_patch_files_arg.getValue();
+    cli_args.outdir = outdir_arg.getValue();
+    cli_args.mesh_dir = mesh_dir_arg.getValue().empty()
+                            ? BaseLib::getProjectDirectory()
+                            : mesh_dir_arg.getValue();
+    cli_args.nonfatal = nonfatal_arg.getValue();
+    cli_args.log_level = log_level_arg.getValue();
+    cli_args.write_prj = write_prj_arg.getValue();
 
     // deactivate buffer for standard output if specified
     if (unbuffered_cout_arg.isSet())
@@ -129,6 +134,8 @@ CommandLineArgumentParser::CommandLineArgumentParser(int argc, char* argv[])
         std::cout.setf(std::ios::unitbuf);
     }
 #ifndef _WIN32
-    enable_fpe_is_set = enable_fpe_arg.isSet();
+    cli_args.enable_fpe_is_set = enable_fpe_arg.isSet();
 #endif  // _WIN32
+
+    return cli_args;
 }
diff --git a/Applications/CLI/CommandLineArgumentParser.h b/Applications/CLI/CommandLineArgumentParser.h
index 6f3af8b75ca9791bde3692bf566b534c0f896271..76692afd8d61bb52734f8221a9e0335da36864d8 100644
--- a/Applications/CLI/CommandLineArgumentParser.h
+++ b/Applications/CLI/CommandLineArgumentParser.h
@@ -15,10 +15,8 @@
 
 #pragma once
 
-struct CommandLineArgumentParser final
+struct CommandLineArguments final
 {
-    CommandLineArgumentParser(int argc, char* argv[]);
-
     std::string reference_path;
     std::string project;
     std::vector<std::string> xml_patch_file_names;
@@ -32,3 +30,6 @@ struct CommandLineArgumentParser final
     bool enable_fpe_is_set;
 #endif  // _WIN32
 };
+
+CommandLineArguments parseCommandLineArguments(
+    int argc, char* argv[], bool const exit_on_exception = true);