chore: improve --list output using is_source_valid

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
This commit is contained in:
Lorenzo Susini 2022-01-04 08:07:29 +00:00 committed by poiana
parent 2ee0645f25
commit cef2c2d5c1

View File

@ -466,9 +466,9 @@ static void check_for_ignored_events(sinsp &inspector, falco_engine &engine)
static void list_source_fields(falco_engine *engine, bool verbose, bool names_only, std::string &source) static void list_source_fields(falco_engine *engine, bool verbose, bool names_only, std::string &source)
{ {
if(source.size() > 0 && if(source.size() > 0 &&
!(source == syscall_source || source == k8s_audit_source)) !engine->is_source_valid(source))
{ {
throw std::invalid_argument("Value for --list must be \"syscall\" or \"k8s_audit\""); throw std::invalid_argument("Value for --list must be a valid source type");
} }
engine->list_fields(source, verbose, names_only); engine->list_fields(source, verbose, names_only);
} }