diff --git a/.clang-tidy b/.clang-tidy index b01d144..10a5a5f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -23,6 +23,7 @@ Checks: > -llvmlibc-*, -misc-non-private-member-variables-in-classes, -modernize-use-nullptr, + -readability-avoid-nested-conditional-operator, -readability-braces-around-statements, -readability-function-cognitive-complexity, -readability-implicit-bool-conversion, diff --git a/_sources/generated.json b/_sources/generated.json deleted file mode 100644 index b8988d2..0000000 --- a/_sources/generated.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "fmt": { - "cargoLocks": null, - "date": null, - "extract": null, - "name": "fmt", - "passthru": null, - "pinned": false, - "src": { - "deepClone": false, - "fetchSubmodules": false, - "leaveDotGit": false, - "name": null, - "owner": "fmtlib", - "repo": "fmt", - "rev": "11.1.4", - "sha256": "sha256-sUbxlYi/Aupaox3JjWFqXIjcaQa0LFjclQAOleT+FRA=", - "sparseCheckout": [], - "type": "github" - }, - "version": "11.1.4" - }, - "tomlplusplus": { - "cargoLocks": null, - "date": null, - "extract": null, - "name": "tomlplusplus", - "passthru": null, - "pinned": false, - "src": { - "deepClone": false, - "fetchSubmodules": false, - "leaveDotGit": false, - "name": null, - "owner": "marzer", - "repo": "tomlplusplus", - "rev": "v3.4.0", - "sha256": "sha256-h5tbO0Rv2tZezY58yUbyRVpsfRjY3i+5TPkkxr6La8M=", - "sparseCheckout": [], - "type": "github" - }, - "version": "v3.4.0" - } -} \ No newline at end of file diff --git a/_sources/generated.nix b/_sources/generated.nix deleted file mode 100644 index 5aed8d6..0000000 --- a/_sources/generated.nix +++ /dev/null @@ -1,26 +0,0 @@ -# This file was generated by nvfetcher, please do not modify it manually. -{ fetchgit, fetchurl, fetchFromGitHub, dockerTools }: -{ - fmt = { - pname = "fmt"; - version = "11.1.4"; - src = fetchFromGitHub { - owner = "fmtlib"; - repo = "fmt"; - rev = "11.1.4"; - fetchSubmodules = false; - sha256 = "sha256-sUbxlYi/Aupaox3JjWFqXIjcaQa0LFjclQAOleT+FRA="; - }; - }; - tomlplusplus = { - pname = "tomlplusplus"; - version = "v3.4.0"; - src = fetchFromGitHub { - owner = "marzer"; - repo = "tomlplusplus"; - rev = "v3.4.0"; - fetchSubmodules = false; - sha256 = "sha256-h5tbO0Rv2tZezY58yUbyRVpsfRjY3i+5TPkkxr6La8M="; - }; - }; -} diff --git a/flake.nix b/flake.nix index b389705..8d77be1 100644 --- a/flake.nix +++ b/flake.nix @@ -31,26 +31,12 @@ ) llvmPackages.stdenv; - sources = import ./_sources/generated.nix { - inherit (pkgs) fetchFromGitHub fetchgit fetchurl dockerTools; - }; - - fmt = pkgs.pkgsStatic.fmt.overrideAttrs (old: { - inherit (sources.fmt) pname version src; - }); - - tomlplusplus = pkgs.pkgsStatic.tomlplusplus.overrideAttrs { - inherit (sources.tomlplusplus) pname version src; - doCheck = false; - }; - deps = with pkgs; [ (glaze.override {enableAvx2 = hostPlatform.isx86;}) ] ++ (with pkgsStatic; [ curl - fmt ftxui libiconv sqlitecpp diff --git a/meson.build b/meson.build index b7edf3d..63aae2d 100644 --- a/meson.build +++ b/meson.build @@ -99,7 +99,6 @@ sources = base_sources + files(platform_sources.get(host_system, [])) # Dependencies Config # # --------------------- # common_deps = [ - dependency('fmt', include_type: 'system', static: true), dependency('libcurl', include_type: 'system', static: true), dependency('tomlplusplus', include_type: 'system', static: true), dependency('openssl', include_type: 'system', static: true, required: false), diff --git a/nvfetcher.toml b/nvfetcher.toml deleted file mode 100644 index b7c89de..0000000 --- a/nvfetcher.toml +++ /dev/null @@ -1,7 +0,0 @@ -[fmt] -src.github = "fmtlib/fmt" -fetch.github = "fmtlib/fmt" - -[tomlplusplus] -src.github = "marzer/tomlplusplus" -fetch.github = "marzer/tomlplusplus" diff --git a/src/config/config.cpp b/src/config/config.cpp index bed2d87..c2862c6 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include diff --git a/src/config/weather.cpp b/src/config/weather.cpp index 3ac3b94..07124e9 100644 --- a/src/config/weather.cpp +++ b/src/config/weather.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include "weather.h" @@ -114,7 +113,7 @@ namespace { curl_easy_cleanup(curl); if (res != CURLE_OK) - return std::unexpected(fmt::format("cURL error: {}", curl_easy_strerror(res))); + return std::unexpected(std::format("cURL error: {}", curl_easy_strerror(res))); WeatherOutput output; @@ -160,7 +159,7 @@ fn Weather::getWeatherInfo() const -> WeatherOutput { DEBUG_LOG("Requesting city: {}", escaped); const string apiUrl = - fmt::format("https://api.openweathermap.org/data/2.5/weather?q={}&appid={}&units={}", escaped, api_key, units); + std::format("https://api.openweathermap.org/data/2.5/weather?q={}&appid={}&units={}", escaped, api_key, units); curl_free(escaped); return handleApiResult(MakeApiRequest(apiUrl)); @@ -169,7 +168,7 @@ fn Weather::getWeatherInfo() const -> WeatherOutput { const auto& [lat, lon] = std::get(location); DEBUG_LOG("Requesting coordinates: lat={:.3f}, lon={:.3f}", lat, lon); - const string apiUrl = fmt::format( + const string apiUrl = std::format( "https://api.openweathermap.org/data/2.5/weather?lat={:.3f}&lon={:.3f}&appid={}&units={}", lat, lon, api_key, units ); diff --git a/src/main.cpp b/src/main.cpp index ace41e6..0025261 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -31,7 +31,6 @@ namespace ui { using ftxui::Color; constexpr int MAX_PARAGRAPH_LENGTH = 30; - constexpr int PADDING = 3; // Color themes struct Theme { @@ -116,13 +115,15 @@ namespace { string month = std::format("{:%B}", ymd); - i32 day = static_cast(ymd.day()); + u32 day = static_cast(ymd.day()); - const char* suffix = (day >= 11 && day <= 13) ? "th" - : (day % 10 == 1) ? "st" - : (day % 10 == 2) ? "nd" - : (day % 10 == 3) ? "rd" - : "th"; + const char* suffix = static_cast( + (day >= 11 && day <= 13) ? "th" + : (day % 10 == 1) ? "st" + : (day % 10 == 2) ? "nd" + : (day % 10 == 3) ? "rd" + : "th" + ); return std::format("{} {}{}", month, day, suffix); } @@ -145,15 +146,15 @@ namespace { SystemData data; // Single-threaded execution for core system info (faster on Windows) - data.date = std::move(GetDate()); - data.host = std::move(GetHost()); - data.kernel_version = std::move(GetKernelVersion()); - data.os_version = std::move(GetOSVersion()); - data.mem_info = std::move(GetMemInfo()); + data.date = GetDate(); + data.host = GetHost(); + data.kernel_version = GetKernelVersion(); + data.os_version = GetOSVersion(); + data.mem_info = GetMemInfo(); // Desktop environment info - data.desktop_environment = std::move(GetDesktopEnvironment()); - data.window_manager = std::move(GetWindowManager()); + data.desktop_environment = GetDesktopEnvironment(); + data.window_manager = GetWindowManager(); // Parallel execution for disk/shell only auto diskShell = std::async(std::launch::async, [] { @@ -210,28 +211,21 @@ namespace { content.push_back(text(string(userIcon) + "Hello " + name + "! ") | bold | color(Color::Cyan)); content.push_back(separator() | color(ui::DEFAULT_THEME.border)); - content.push_back(hbox( - { - text(string(paletteIcon)) | color(ui::DEFAULT_THEME.icon), - CreateColorCircles(), - } - )); + content.push_back(hbox({ + text(string(paletteIcon)) | color(ui::DEFAULT_THEME.icon), + CreateColorCircles(), + })); content.push_back(separator() | color(ui::DEFAULT_THEME.border)); // Helper function for aligned rows - auto createRow = [&](Icon&& icon, Label&& label, Value&& value) - requires std::constructible_from && std::constructible_from && - std::constructible_from - { - return hbox( - { - text(string(std::forward(icon))) | color(ui::DEFAULT_THEME.icon), - text(string(std::forward