19 lines
493 B
C++
19 lines
493 B
C++
#include "Validators.h"
|
|
#include "spark/utils/FileUtils.h"
|
|
#include <fmt/format.h>
|
|
|
|
namespace bts::cmds {
|
|
|
|
CLI::Validator Validators::file_exists() {
|
|
return CLI::Validator(
|
|
[](const std::string &path) -> std::string {
|
|
if (spartan::FileUtils::file_exists(path)) {
|
|
return "";
|
|
}
|
|
return fmt::format("The file '{}' does not exist.", path);
|
|
},
|
|
"file_exists_validator", "Validates that the file exists");
|
|
}
|
|
|
|
} // namespace bts::cmds
|