From 563638d166c152e7285797994c14989d53a74c24 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Mon, 6 Jan 2025 09:32:13 +0100 Subject: [PATCH] Add implementation --- premake.make | 2 +- src/main.cpp | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/premake.make b/premake.make index 69cc27e..a68c732 100644 --- a/premake.make +++ b/premake.make @@ -1,5 +1,5 @@ # Define linker flags here, like: -lsqlite3 -lpthread -LDLIBS := +LDLIBS := -lscrequest -lscterm # Dir name becomes product name. PROJ := $(shell basename $$(pwd)) diff --git a/src/main.cpp b/src/main.cpp index 3aa5ba1..b2025bc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,10 @@ #include #include #include +#include +#include #include +#include #include "version.hpp" void print_help() { @@ -48,7 +51,17 @@ int main(int argc, char* argv[]) { std::cerr << "gitlabvers: " << ex.what() << '\n'; } } - std::cout << "hello, gitlabvers\n"; + sc::requester req; + std::istringstream text {req.get("https://gitlab.com/gitlab-org/gitlab-foss/-/raw/master/CHANGELOG.md")}; + std::string line; + for (size_t i = 0; i < 5; ++i) { + std::getline(text, line); + } + std::regex pat {R"(\d+\.\d+\.\d+)"}; + std::smatch match; + if (std::regex_search(line, match, pat)) { + std::cout << match[0] << '\n'; + } } catch (const std::exception& ex) { std::cerr << "gitlabvers: " << ex.what() << '\n'; return EXIT_FAILURE;