From 484095576cf124c0ade81530629f34e6a06b4dde Mon Sep 17 00:00:00 2001 From: Clortox Date: Sun, 25 Jul 2021 17:15:47 -0400 Subject: [PATCH] Check for args and dont display misc --- src/main.cpp | 4 +++- src/rss_out.cpp | 30 ++++++++++++++++++++++++++++++ src/rss_out.hpp | 1 + 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 52d974a..08bd87e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,9 @@ int main(int argc, char** argv) { //display requested attributes and items - std::string output = rss_utils::rss_to_list(feed, opts); + std::string output = ""; + if(!rss_utils::rss_opts_empty(opts)) + output = rss_utils::rss_to_list(feed, opts); if(opts->items != nullptr){ feed.getItems(); diff --git a/src/rss_out.cpp b/src/rss_out.cpp index 783620e..6278984 100644 --- a/src/rss_out.cpp +++ b/src/rss_out.cpp @@ -82,3 +82,33 @@ std::string rss_utils::rss_to_items(const rss& rss_obj, const option_flags* flag return ret; } + +bool rss_utils::rss_opts_empty(const option_flags* flags){ + if(flags->title) + return false; + if(flags->link) + return false; + if(flags->description) + return false; + if(flags->language) + return false; + if(flags->webmaster) + return false; + if(flags->copyright) + return false; + if(flags->pubdate) + return false; + if(flags->managingeditor) + return false; + if(flags->generator) + return false; + if(flags->docs) + return false; + if(flags->ttl) + return false; + if(flags->builddate) + return false; + + return true; + +} diff --git a/src/rss_out.hpp b/src/rss_out.hpp index 18e8c77..b473e86 100644 --- a/src/rss_out.hpp +++ b/src/rss_out.hpp @@ -14,5 +14,6 @@ namespace rss_utils { std::string rss_to_list(const rss&, const option_flags*); std::string rss_to_items(const rss&, const option_flags*); + bool rss_opts_empty(const option_flags*); }