commands.ts 1.4 KB
Newer Older
J
Joao Moreno 已提交
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

J
Joao Moreno 已提交
8
import { commands, Disposable, SCMResourceGroup, SCMResource } from 'vscode';
9
import { Model } from './model';
J
Joao Moreno 已提交
10 11 12 13 14 15 16 17
import { log } from './util';

function refresh(model: Model): () => void {
	return () => {
		log('refresh');
		model.update();
	};
}
J
Joao Moreno 已提交
18

J
Joao Moreno 已提交
19 20
function open(...args: any[]): void {
	console.log('open', args);
J
Joao Moreno 已提交
21 22
}

J
Joao Moreno 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
function stage(resource: SCMResource): void {
	log('stage', resource);
}

function stageAll(resourceGroup: SCMResourceGroup): void {
	log('stage-all', resourceGroup);
}

function unstage(resource: SCMResource): void {
	log('unstage', resource);
}

function unstageAll(resourceGroup: SCMResourceGroup): void {
	log('unstage-all', resourceGroup);
}

39
export function registerCommands(model: Model): Disposable {
J
Joao Moreno 已提交
40
	const disposables = [
J
Joao Moreno 已提交
41
		commands.registerCommand('git.refresh', refresh(model)),
J
Joao Moreno 已提交
42 43 44 45
		commands.registerCommand('git.stage', stage),
		commands.registerCommand('git.stage-all', stageAll),
		commands.registerCommand('git.unstage', unstage),
		commands.registerCommand('git.unstage-all', unstageAll),
J
Joao Moreno 已提交
46
		commands.registerCommand('git.open', open)
J
Joao Moreno 已提交
47 48 49
	];

	return Disposable.from(...disposables);
J
Joao Moreno 已提交
50
}