提交 bcf2f1da 编写于 作者: J Joao Moreno

git: init

上级 df2143f5
......@@ -311,8 +311,23 @@ export class CommandCenter {
@command('git.init')
async init(): Promise<void> {
// TODO@joao
// await model.init();
const value = workspace.workspaceFolders && workspace.workspaceFolders.length > 0
? workspace.workspaceFolders[0].uri.fsPath
: os.homedir();
const path = await window.showInputBox({
placeHolder: localize('path to init', "Folder path"),
prompt: localize('provide path', "Please provide a folder path to initialize a Git repository"),
value,
ignoreFocusOut: true
});
if (!path) {
return;
}
await this.git.init(path);
await this.model.tryOpenRepository(path);
}
@command('git.openFile')
......
......@@ -84,7 +84,7 @@ export class Model {
}
@sequentialize
private async tryOpenRepository(path: string): Promise<void> {
async tryOpenRepository(path: string): Promise<void> {
const repository = this.getRepository(path);
if (repository) {
......
......@@ -201,15 +201,14 @@ export enum Operation {
Pull = 1 << 9,
Push = 1 << 10,
Sync = 1 << 11,
Init = 1 << 12,
Show = 1 << 13,
Stage = 1 << 14,
GetCommitTemplate = 1 << 15,
DeleteBranch = 1 << 16,
Merge = 1 << 17,
Ignore = 1 << 18,
Tag = 1 << 19,
Stash = 1 << 20
Show = 1 << 12,
Stage = 1 << 13,
GetCommitTemplate = 1 << 14,
DeleteBranch = 1 << 15,
Merge = 1 << 16,
Ignore = 1 << 17,
Tag = 1 << 18,
Stash = 1 << 19
}
// function getOperationName(operation: Operation): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册