提交 992704e8 编写于 作者: J Joao Moreno

git: structure commands

上级 1b6aa438
......@@ -9,56 +9,58 @@ import { commands, Disposable, SCMResourceGroup, SCMResource } from 'vscode';
import { Model } from './model';
import { log } from './util';
function refresh(model: Model): () => void {
return () => {
log('refresh');
model.update();
};
function refresh(model: Model): void {
log('refresh');
model.update();
}
function openChange(resource: SCMResource): void {
function openChange(model: Model, resource: SCMResource): void {
log('open change', resource);
}
function openFile(resource: SCMResource): void {
function openFile(model: Model, resource: SCMResource): void {
log('open file', resource);
}
function stage(resource: SCMResource): void {
function stage(model: Model, resource: SCMResource): void {
log('stage', resource);
}
function stageAll(resourceGroup: SCMResourceGroup): void {
function stageAll(model: Model, resourceGroup: SCMResourceGroup): void {
log('stageAll', resourceGroup);
}
function unstage(resource: SCMResource): void {
function unstage(model: Model, resource: SCMResource): void {
log('unstage', resource);
}
function unstageAll(resourceGroup: SCMResourceGroup): void {
function unstageAll(model: Model, resourceGroup: SCMResourceGroup): void {
log('unstageAll', resourceGroup);
}
function clean(resource: SCMResource): void {
function clean(model: Model, resource: SCMResource): void {
log('clean', resource);
}
function cleanAll(resourceGroup: SCMResourceGroup): void {
function cleanAll(model: Model, resourceGroup: SCMResourceGroup): void {
log('clean all', resourceGroup);
}
function bind(command: (model: Model, ...args: any[]) => any, model: Model): (...args: any[]) => any {
return command.bind(null, model);
}
export function registerCommands(model: Model): Disposable {
const disposables = [
commands.registerCommand('git.refresh', refresh(model)),
commands.registerCommand('git.openChange', openChange),
commands.registerCommand('git.openFile', openFile),
commands.registerCommand('git.stage', stage),
commands.registerCommand('git.stageAll', stageAll),
commands.registerCommand('git.unstage', unstage),
commands.registerCommand('git.unstageAll', unstageAll),
commands.registerCommand('git.clean', clean),
commands.registerCommand('git.cleanAll', cleanAll),
commands.registerCommand('git.refresh', bind(refresh, model)),
commands.registerCommand('git.openChange', bind(openChange, model)),
commands.registerCommand('git.openFile', bind(openFile, model)),
commands.registerCommand('git.stage', bind(stage, model)),
commands.registerCommand('git.stageAll', bind(stageAll, model)),
commands.registerCommand('git.unstage', bind(unstage, model)),
commands.registerCommand('git.unstageAll', bind(unstageAll, model)),
commands.registerCommand('git.clean', bind(clean, model)),
commands.registerCommand('git.cleanAll', bind(cleanAll, model)),
];
return Disposable.from(...disposables);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册