From 6a4cf5ca07c27d2e48e6ac2bd88ee5ff3428a32c Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 17 Apr 2019 01:23:23 +0200 Subject: [PATCH] Print release names. --- src/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 428b200..154b5c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "version.hpp" using std::cout; @@ -31,6 +32,7 @@ using std::cerr; using std::endl; using std::string; using std::ostringstream; +using std::stringstream; using std::uint16_t; namespace curlopts = curlpp::options; @@ -84,7 +86,15 @@ int main(int argc, char *argv[]) const string baseurl = url.substr(0, pos_repo - 1); const string repo = url.substr(pos_repo); - cout << get_http(baseurl + "/api/v1/repos/" + repo + "/releases"); + stringstream data(get_http(baseurl + "/api/v1/repos/" + + repo + "/releases")); + Json::Value json; + data >> json; + for (const Json::Value &release : json) + { + cout << release["name"] << endl; + // cout << release["body"] << endl; + } return 0; }