more submodule support, diff colorization

This commit is contained in:
Joao Moreno
2017-12-13 16:21:12 +01:00
parent 0cd53b2d9b
commit 9f131c1762
10 changed files with 455 additions and 61 deletions

View File

@@ -597,6 +597,10 @@ export function parseGitmodules(raw: string): Submodule[] {
return result;
}
export interface DiffOptions {
cached?: boolean;
}
export class Repository {
constructor(
@@ -735,6 +739,19 @@ export class Repository {
}
}
async diff(path: string, options: DiffOptions = {}): Promise<string> {
const args = ['diff'];
if (options.cached) {
args.push('--cached');
}
args.push('--', path);
const result = await this.run(args);
return result.stdout;
}
async add(paths: string[]): Promise<void> {
const args = ['add', '-A', '--'];