blob: 2a425f6dfd5e52311ae57c7ec4bda5f6020d39b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import simpleGit, {ConfigValues, SimpleGit} from "simple-git";
export default class GitConfig {
private gitConfig: ConfigValues;
public constructor() {
const git: SimpleGit = simpleGit();
git.listConfig().then((result) => {
this.gitConfig = result.all;
});
}
/** git config --get user.name */
get UserName(): string {
try {
return this.gitConfig["user.name"].toString();
} catch (error) {
return "";
}
}
/** git config --get user.email */
get UserEmail(): string {
try {
return this.gitConfig["user.email"].toString();
} catch (error) {
return "";
}
}
}
|