diff --git a/include/config.hpp b/include/config.hpp index 2609149..d7f5a8e 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -40,6 +40,7 @@ struct _color_t { fmt::rgb others; fmt::rgb version; fmt::rgb popularity; + fmt::rgb votes; fmt::rgb installed; fmt::rgb index; }; @@ -173,6 +174,7 @@ gray = "#5a5a5a" #version = "#00ff00" #popularity = "#00ffff" +#votes = "#00ffff" #installed = "#5a5a5a" #index = "#ff11cc" )#"; diff --git a/include/taur.hpp b/include/taur.hpp index 4550e92..2eb830f 100644 --- a/include/taur.hpp +++ b/include/taur.hpp @@ -26,6 +26,7 @@ struct TaurPkg_t { string url; string desc; float popularity = 1; // normal + float votes; vector depends; bool installed = false; string db_name = "aur"; diff --git a/src/config.cpp b/src/config.cpp index 70328a6..33d3988 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -169,6 +169,7 @@ void Config::initColors() { color.others = this->getThemeValue("others", "#ff11cc"); color.version = this->getThemeValue("version", "#00ff00"); color.popularity = this->getThemeValue("popularity", "#00ffff"); + color.votes = this->getThemeValue("votes", "#00ffff"); color.installed = this->getThemeValue("installed", "#5a5a5a"); color.index = this->getThemeValue("index", "#ff11cc"); } diff --git a/src/main.cpp b/src/main.cpp index 5c28240..51732ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -61,6 +61,7 @@ void test_colors() { .version = VERSION, .desc = "A customizable and lightweight AUR helper, designed to be simple but powerful.", .popularity = 100, + .votes = 34.1, .installed = true, .db_name = "aur", }; @@ -88,6 +89,7 @@ void test_colors() { fmt::println(BOLD_TEXT(color.version), "\n(bold) version " VERSION); fmt::println(fg(color.popularity), "Popularity: {} ({})", pkg.popularity, getTitleForPopularity(pkg.popularity)); + fmt::println(fg(color.votes), "Votes: {}", pkg.votes); fmt::println(fg(color.index), "index [1]"); fmt::println(fg(color.installed), "indicator [Installed]"); diff --git a/src/taur.cpp b/src/taur.cpp index b8d1cbb..251e00f 100644 --- a/src/taur.cpp +++ b/src/taur.cpp @@ -76,6 +76,7 @@ TaurPkg_t parsePkg(rapidjson::Value& pkgJson, bool returnGit = false) { getUrl(pkgJson, returnGit), // url pkgJson["Description"].IsString() ? pkgJson["Description"].GetString() : "", // description pkgJson["Popularity"].GetFloat(), // popularity + pkgJson["NumVotes"].GetFloat(), // votes depends, // depends alpm_db_get_pkg(alpm_get_localdb(config->handle), pkgJson["Name"].GetString()) != nullptr, // installed }; diff --git a/src/util.cpp b/src/util.cpp index cc7124c..bce297b 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -364,11 +364,12 @@ void printPkgInfo(TaurPkg_t& pkg, string db_name, int index) { fmt::print(fmt::fg(color.index), "[{}] ", index); fmt::print(getColorFromDBName(db_name), "{}/", db_name); - fmt::print(fmt::emphasis::bold, "{} ", pkg.name); + fmt::print(BOLD, "{} ", pkg.name); fmt::print(BOLD_TEXT(color.version), "{} ", pkg.version); - fmt::print(fmt::fg(color.popularity), " Popularity: {} ({}) ", pkg.popularity, getTitleForPopularity(pkg.popularity)); + fmt::print(fg(color.popularity), " Popularity: {:.2f} ({}) ", pkg.popularity, getTitleForPopularity(pkg.popularity)); + fmt::print(fg(color.votes), "Votes: {} ", pkg.votes); if (pkg.installed) - fmt::println(fmt::fg(color.installed), "[Installed]"); + fmt::println(fg(color.installed), "[Installed]"); else fmt::print("\n"); fmt::println(" {}", pkg.desc);