Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ class App {
/// This is a function that runs when all processing has completed
std::function<void()> final_callback_{};

/// This is a function tat runs after all standard requirement checks havv been processed
std::function<void()> require_callback_{};

///@}
/// @name Options
///@{
Expand Down Expand Up @@ -376,6 +379,13 @@ class App {
return this;
}

/// Set a callback to execute after all standard requirement checks have been processed
///
App *require_callback(std::function<void()> req_callback) {
require_callback_ = std::move(req_callback);
return this;
}

/// Set a name for the app (empty will use parser to set the name)
App *name(std::string app_name = "");

Expand Down
4 changes: 4 additions & 0 deletions include/CLI/impl/App_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,10 @@ CLI11_INLINE void App::_process_requirements() {
throw(CLI::RequiredError(sub->get_display_name()));
}
}

if (require_callback_) {
require_callback_();
}
}

CLI11_INLINE void App::_process() {
Expand Down
Loading