| 60 | { |
| 61 | public: |
| 62 | UnknownPackage(std::string_view package, |
| 63 | const std::vector<std::string>& allPackages, DebugInfo info) |
| 64 | : Exception("UnknownPackage", info) |
| 65 | { |
| 66 | this->error( |
| 67 | "Impossible to get Package '{}', please check it is correctly installed"); |
| 68 | std::vector<std::string> suggestions |
| 69 | = Utils::String::sortByDistance(package.data(), allPackages, 5); |
| 70 | std::transform(suggestions.begin(), suggestions.end(), suggestions.begin(), |
| 71 | Utils::String::quote); |
| 72 | this->hint("Maybe you meant to get one of these packages : ({})", |
| 73 | fmt::join(suggestions, ", ")); |
| 74 | } |
| 75 | }; |
| 76 | |
| 77 | class PackageFileNotFound : public Exception |