diff --git a/userspace/engine/falco_engine.h b/userspace/engine/falco_engine.h index 73a9696f..e91eb855 100644 --- a/userspace/engine/falco_engine.h +++ b/userspace/engine/falco_engine.h @@ -34,7 +34,7 @@ limitations under the License. #include "falco_source.h" #include "falco_load_result.h" #include "filter_details_resolver.h" -#include "../falco/output_format.h" +#include "output_format.h" // // This class acts as the primary interface between a program and the @@ -63,7 +63,10 @@ public: // Print to stdout (using printf) a description of each field supported by this engine. // If source is non-empty, only fields for the provided source are printed. - void list_fields(const std::string &source, bool verbose, bool names_only, output_format format) const; + void list_fields(const std::string &source, + bool verbose, + bool names_only, + output_format format) const; // Provide an alternate rule reader, collector, and compiler // to compile any rules provided via load_rules* diff --git a/userspace/engine/field_formatter.h b/userspace/engine/field_formatter.h index c11b911a..83c6a65c 100644 --- a/userspace/engine/field_formatter.h +++ b/userspace/engine/field_formatter.h @@ -57,7 +57,7 @@ public: void begin() override; void print_fieldclass(const sinsp_filter_factory::filter_fieldclass_info& fld_class, - const std::set& event_sources) override; + const std::set& event_sources) override; void print_field_name(const std::string& name) override; void end() override; @@ -72,7 +72,7 @@ public: void begin() override; void print_fieldclass(const sinsp_filter_factory::filter_fieldclass_info& fld_class, - const std::set& event_sources) override; + const std::set& event_sources) override; void print_field_name(const std::string& name) override; void end() override; @@ -87,7 +87,7 @@ public: void begin() override; void print_fieldclass(const sinsp_filter_factory::filter_fieldclass_info& fld_class, - const std::set& event_sources) override; + const std::set& event_sources) override; void print_field_name(const std::string& name) override; void end() override; diff --git a/userspace/falco/output_format.h b/userspace/engine/output_format.h similarity index 86% rename from userspace/falco/output_format.h rename to userspace/engine/output_format.h index 44416c70..775d0ce1 100644 --- a/userspace/falco/output_format.h +++ b/userspace/engine/output_format.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: Apache-2.0 /* Copyright (C) 2026 The Falco Authors. @@ -16,8 +17,4 @@ limitations under the License. #pragma once -enum class output_format { - TEXT, - MARKDOWN, - JSON -}; +enum class output_format { TEXT, MARKDOWN, JSON }; diff --git a/userspace/falco/app/actions/event_formatter.cpp b/userspace/falco/app/actions/event_formatter.cpp index 02a3784e..59e75bf5 100644 --- a/userspace/falco/app/actions/event_formatter.cpp +++ b/userspace/falco/app/actions/event_formatter.cpp @@ -102,7 +102,6 @@ void MarkdownFormatter::begin_category(const std::string& category) { printf("## %s\n\n", category.c_str()); printf("Default | Dir | Name | Params \n"); printf(":-------|:----|:-----|:-----\n"); - m_first_event_in_category = true; } void MarkdownFormatter::print_event(const event_entry& e) { diff --git a/userspace/falco/app/actions/event_formatter.h b/userspace/falco/app/actions/event_formatter.h index 7652b9fd..08d2097c 100644 --- a/userspace/falco/app/actions/event_formatter.h +++ b/userspace/falco/app/actions/event_formatter.h @@ -23,7 +23,7 @@ limitations under the License. #include #include -#include "../../output_format.h" +#include "../../../engine/output_format.h" struct ppm_param_info; struct ppm_event_info; @@ -87,7 +87,6 @@ public: private: void print_param(const struct ppm_param_info* param); - bool m_first_event_in_category{true}; }; // JSON formatter diff --git a/userspace/falco/app/options.cpp b/userspace/falco/app/options.cpp index bde5cc11..2a276353 100644 --- a/userspace/falco/app/options.cpp +++ b/userspace/falco/app/options.cpp @@ -30,7 +30,9 @@ limitations under the License. namespace falco { namespace app { -static bool parse_output_format(const std::string& format_str, output_format& out, std::string& errstr) { +static bool parse_output_format(const std::string &format_str, + output_format &out, + std::string &errstr) { if(format_str.empty()) { return true; } @@ -117,6 +119,7 @@ bool options::parse(int argc, char **argv, std::string &errstr) { } } else if(markdown) { // If markdown flag is set and format is not specified, use MARKDOWN format + fprintf(stderr, "WARNING: --markdown is deprecated, use --format markdown instead.\n"); output_fmt = output_format::MARKDOWN; } diff --git a/userspace/falco/app/options.h b/userspace/falco/app/options.h index af341d76..ff393edf 100644 --- a/userspace/falco/app/options.h +++ b/userspace/falco/app/options.h @@ -18,7 +18,7 @@ limitations under the License. #pragma once #include -#include "../output_format.h" +#include "../../engine/output_format.h" #include #include