В библиотеку добавлена функция разбития строки по первому символу пробела
This commit is contained in:
		
							parent
							
								
									a74579d709
								
							
						
					
					
						commit
						8a64320214
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
					@ -2,6 +2,8 @@ module snag.lib.lib;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import std.regex;
 | 
					import std.regex;
 | 
				
			||||||
import std.process;
 | 
					import std.process;
 | 
				
			||||||
 | 
					import std.algorithm;
 | 
				
			||||||
 | 
					import std.string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool isValidHash(string hash) {
 | 
					bool isValidHash(string hash) {
 | 
				
			||||||
	auto hashPattern = ctRegex!r"^[a-fA-F0-9]{7}$";
 | 
						auto hashPattern = ctRegex!r"^[a-fA-F0-9]{7}$";
 | 
				
			||||||
| 
						 | 
					@ -17,3 +19,9 @@ bool checkGit() {
 | 
				
			||||||
	auto result = execute(["which", "git"]);
 | 
						auto result = execute(["which", "git"]);
 | 
				
			||||||
	return !result.status;
 | 
						return !result.status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					string[] splitByFirstSpace(string line) {
 | 
				
			||||||
 | 
						auto spaceIndex = line.indexOf(' ');
 | 
				
			||||||
 | 
						return spaceIndex == -1 ?
 | 
				
			||||||
 | 
							[line] : [line[0 .. spaceIndex], line[spaceIndex + 1..$]];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue