В библиотеку добавлена функция разбития строки по первому символу пробела

This commit is contained in:
Alexander Zhirov 2025-05-30 19:06:29 +03:00
parent a74579d709
commit 8a64320214
Signed by: alexander
GPG key ID: C8D8BE544A27C511

View file

@ -2,6 +2,8 @@ module snag.lib.lib;
import std.regex;
import std.process;
import std.algorithm;
import std.string;
bool isValidHash(string hash) {
auto hashPattern = ctRegex!r"^[a-fA-F0-9]{7}$";
@ -17,3 +19,9 @@ bool checkGit() {
auto result = execute(["which", "git"]);
return !result.status;
}
string[] splitByFirstSpace(string line) {
auto spaceIndex = line.indexOf(' ');
return spaceIndex == -1 ?
[line] : [line[0 .. spaceIndex], line[spaceIndex + 1..$]];
}