git: clean command

This commit is contained in:
Joao Moreno 2017-01-09 10:41:33 +01:00
parent 1d2bf7f43f
commit 8abfb94806
4 changed files with 66 additions and 9 deletions

View file

@ -31,10 +31,15 @@
}
},
{
"command": "git.open",
"command": "git.openChange",
"title": "Open Change",
"category": "Git"
},
{
"command": "git.openFile",
"title": "Open File",
"category": "Git"
},
{
"command": "git.stage",
"title": "Stage",
@ -70,6 +75,15 @@
"light": "resources/icons/light/unstage.svg",
"dark": "resources/icons/dark/unstage.svg"
}
},
{
"command": "git.clean",
"title": "Clean",
"category": "Git",
"icon": {
"light": "resources/icons/light/clean.svg",
"dark": "resources/icons/dark/clean.svg"
}
}
],
"menus": {
@ -102,22 +116,52 @@
],
"scm/resource/context": [
{
"command": "git.unstage",
"command": "git.openChange",
"when": "scmProvider == git && scmResourceGroup == index"
},
{
"command": "git.openFile",
"when": "scmProvider == git && scmResourceGroup == index"
},
{
"command": "git.unstage",
"group": "inline",
"when": "scmProvider == git && scmResourceGroup == index"
"when": "scmProvider == git && scmResourceGroup == index",
"group": "1_modification"
},
{
"command": "git.unstage",
"when": "scmProvider == git && scmResourceGroup == index",
"group": "inline"
},
{
"command": "git.openChange",
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "navigation"
},
{
"command": "git.openFile",
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "navigation"
},
{
"command": "git.stage",
"when": "scmProvider == git && scmResourceGroup == workingTree"
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "1_modification"
},
{
"command": "git.clean",
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "1_modification"
},
{
"command": "git.clean",
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "inline"
},
{
"command": "git.stage",
"group": "inline",
"when": "scmProvider == git && scmResourceGroup == workingTree"
"when": "scmProvider == git && scmResourceGroup == workingTree",
"group": "inline"
}
]
},

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-0.994 0 16 16" enable-background="new -0.994 0 16 16"><path fill="#C5C5C5" d="M13 6c0 1.461-.636 2.846-1.746 3.797l-5.584 4.951-1.324-1.496 5.595-4.962c.678-.582 1.061-1.413 1.061-2.29 0-1.654-1.345-3-2.997-3-.71 0-1.399.253-1.938.713l-1.521 1.287h2.448l-1.998 2h-3.996v-4l1.998-2v2.692l1.775-1.504c.899-.766 2.047-1.188 3.232-1.188 2.754 0 4.995 2.243 4.995 5z"/></svg>

After

Width:  |  Height:  |  Size: 443 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-0.994 0 16 16" enable-background="new -0.994 0 16 16"><path fill="#424242" d="M13 6c0 1.461-.636 2.846-1.746 3.797l-5.584 4.951-1.324-1.496 5.595-4.962c.678-.582 1.061-1.413 1.061-2.29 0-1.654-1.345-3-2.997-3-.71 0-1.399.253-1.938.713l-1.521 1.287h2.448l-1.998 2h-3.996v-4l1.998-2v2.692l1.775-1.504c.899-.766 2.047-1.188 3.232-1.188 2.754 0 4.995 2.243 4.995 5z"/></svg>

After

Width:  |  Height:  |  Size: 443 B

View file

@ -16,7 +16,11 @@ function refresh(model: Model): () => void {
};
}
function open(...args: any[]): void {
function openChange(...args: any[]): void {
console.log('open', args);
}
function openFile(...args: any[]): void {
console.log('open', args);
}
@ -36,14 +40,21 @@ function unstageAll(resourceGroup: SCMResourceGroup): void {
log('unstage-all', resourceGroup);
}
function clean(resource: SCMResource): void {
log('clean', resource);
}
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.stage-all', stageAll),
commands.registerCommand('git.unstage', unstage),
commands.registerCommand('git.unstage-all', unstageAll),
commands.registerCommand('git.open', open)
commands.registerCommand('git.clean', clean),
];
return Disposable.from(...disposables);