29 lines
492 B
D
29 lines
492 B
D
module comp.git;
|
|
|
|
import std.stdio;
|
|
import std.file : dirEntries, SpanMode;
|
|
import std.process;
|
|
import std.string : strip;
|
|
|
|
string gitBranch() {
|
|
auto result = execute(["git", "rev-parse", "--abbrev-ref", "HEAD"]);
|
|
|
|
if (result.status != 0)
|
|
return null;
|
|
|
|
return result.output.strip();
|
|
}
|
|
|
|
string gitStatus() {
|
|
auto result = execute(["git", "status", "--porcelain"]);
|
|
|
|
if (result.status != 0)
|
|
return null;
|
|
|
|
if (result.output.length >= 1) {
|
|
return "*";
|
|
}
|
|
|
|
return "";
|
|
}
|