mirror of
https://github.com/kahole/edamagit.git
synced 2024-09-11 07:15:31 +03:00
adds remoting commands
This commit is contained in:
parent
7050709029
commit
09bfd6a09d
13
package.json
13
package.json
@ -70,6 +70,10 @@
|
||||
"command": "extension.magit-pulling",
|
||||
"title": "Magit Pulling"
|
||||
},
|
||||
{
|
||||
"command": "extension.magit-remoting",
|
||||
"title": "Magit Remoting"
|
||||
},
|
||||
{
|
||||
"command": "extension.magit-stage",
|
||||
"title": "Magit Stage"
|
||||
@ -113,6 +117,10 @@
|
||||
"command": "extension.magit-rebasing",
|
||||
"when": "editorLangId == magit"
|
||||
},
|
||||
{
|
||||
"command": "extension.magit-remoting",
|
||||
"when": "editorLangId == magit"
|
||||
},
|
||||
{
|
||||
"command": "extension.magit-visit-at-point",
|
||||
"when": "editorLangId == magit"
|
||||
@ -250,6 +258,11 @@
|
||||
"key": "r",
|
||||
"when": "editorTextFocus && editorLangId == magit"
|
||||
},
|
||||
{
|
||||
"command": "extension.magit-remoting",
|
||||
"key": "shift+m",
|
||||
"when": "editorTextFocus && editorLangId == magit"
|
||||
},
|
||||
{
|
||||
"command": "extension.magit-pushing",
|
||||
"key": "shift+p",
|
||||
|
@ -1,2 +1,40 @@
|
||||
import { MagitRepository } from "../models/magitRepository";
|
||||
import { MenuUtil, MenuState } from "../menu/menu";
|
||||
import { commands, window } from "vscode";
|
||||
import { gitRun } from "../utils/gitRawRunner";
|
||||
|
||||
// TODO: MVP remoting commands
|
||||
const remotingMenu = {
|
||||
title: 'Remoting',
|
||||
commands: [
|
||||
{ label: 'a', description: 'Add', action: addRemote },
|
||||
{ label: 'r', description: 'Rename', action: renameRemote },
|
||||
{ label: 'k', description: 'Remove', action: removeRemote }
|
||||
]
|
||||
};
|
||||
|
||||
export async function remoting(repository: MagitRepository) {
|
||||
return MenuUtil.showMenu(remotingMenu, { repository });
|
||||
}
|
||||
|
||||
async function addRemote() {
|
||||
return commands.executeCommand('git.addRemote');
|
||||
}
|
||||
|
||||
async function renameRemote({ repository }: MenuState) {
|
||||
|
||||
const remote = await window.showQuickPick(repository.state.remotes.map(r => r.name), { placeHolder: 'Rename remote' });
|
||||
|
||||
if (remote) {
|
||||
|
||||
const newName = await window.showInputBox({ prompt: `Rename ${remote} to` });
|
||||
|
||||
if (newName) {
|
||||
const args = ['remote', 'rename', remote, newName];
|
||||
gitRun(repository, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function removeRemote() {
|
||||
return commands.executeCommand('git.removeRemote');
|
||||
}
|
@ -24,6 +24,7 @@ import { rebasing } from './commands/rebasingCommands';
|
||||
import { filePopup } from './commands/filePopupCommands';
|
||||
import { DispatchView } from './views/dispatchView';
|
||||
import MagitUtils from './utils/magitUtils';
|
||||
import { remoting } from './commands/remotingCommands';
|
||||
|
||||
export const magitRepositories: Map<string, MagitRepository> = new Map<string, MagitRepository>();
|
||||
export const views: Map<string, DocumentView> = new Map<string, DocumentView>();
|
||||
@ -69,6 +70,7 @@ export function activate(context: ExtensionContext) {
|
||||
context.subscriptions.push(commands.registerTextEditorCommand('extension.magit-branching', Command.primeRepo(branching)));
|
||||
context.subscriptions.push(commands.registerTextEditorCommand('extension.magit-merging', Command.primeRepo(merging)));
|
||||
context.subscriptions.push(commands.registerTextEditorCommand('extension.magit-rebasing', Command.primeRepo(rebasing)));
|
||||
context.subscriptions.push(commands.registerTextEditorCommand('extension.magit-remoting', Command.primeRepo(remoting)));
|
||||
|
||||
context.subscriptions.push(commands.registerTextEditorCommand('extension.magit-visit-at-point', Command.primeRepoAndView(magitVisitAtPoint, false)));
|
||||
context.subscriptions.push(commands.registerTextEditorCommand('extension.magit-apply-at-point', Command.primeRepoAndView(magitApplyEntityAtPoint)));
|
||||
|
Loading…
Reference in New Issue
Block a user