Check for args and dont display misc

This commit is contained in:
Clortox 2021-07-25 17:15:47 -04:00
parent 95e822bbc6
commit 484095576c
3 changed files with 34 additions and 1 deletions

View File

@ -34,7 +34,9 @@ int main(int argc, char** argv) {
//display requested attributes and items //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){ if(opts->items != nullptr){
feed.getItems(); feed.getItems();

View File

@ -82,3 +82,33 @@ std::string rss_utils::rss_to_items(const rss& rss_obj, const option_flags* flag
return ret; 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;
}

View File

@ -14,5 +14,6 @@
namespace rss_utils { namespace rss_utils {
std::string rss_to_list(const rss&, const option_flags*); std::string rss_to_list(const rss&, const option_flags*);
std::string rss_to_items(const rss&, const option_flags*); std::string rss_to_items(const rss&, const option_flags*);
bool rss_opts_empty(const option_flags*);
} }