Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
fix: readd github enterpise token command
Browse files Browse the repository at this point in the history
Fix erroneous removal of github enterprise token command.

Closes #203
  • Loading branch information
KnisterPeter committed Sep 27, 2017
1 parent 8be58ac commit 464538c
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions src/commands/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class SetGithubToken extends Command {
private context: vscode.ExtensionContext;

@inject
private githubManager: WorkflowManager;
private workflowManager: WorkflowManager;

public async run(): Promise<void> {
this.track('execute');
Expand All @@ -30,7 +30,44 @@ export class SetGithubToken extends Command {
provider: 'github'
};
this.context.globalState.update('tokens', tokens);
await this.githubManager.connect(tokens);
await this.workflowManager.connect(tokens);
}
}

}

@component({eager: true})
export class SetGithubEnterpriseToken extends Command {

public id = 'vscode-github.setGitHubEnterpriseToken';

@inject('vscode.ExtensionContext')
private context: vscode.ExtensionContext;

@inject
private workflowManager: WorkflowManager;

public async run(): Promise<void> {
this.track('execute');
const hostInput = await vscode.window.showInputBox({
ignoreFocusOut: true,
placeHolder: 'GitHub Enterprise Hostname'
});
if (hostInput) {
const tokenInput = await vscode.window.showInputBox({
ignoreFocusOut: true,
password: true,
placeHolder: 'GitHub Enterprise Token'
});
if (tokenInput) {
const tokens = this.context.globalState.get<Tokens>('tokens', {});
tokens[hostInput] = {
token: tokenInput,
provider: 'github'
};
this.context.globalState.update('tokens', tokens);
this.workflowManager.connect(tokens);
}
}
}

Expand Down

0 comments on commit 464538c

Please sign in to comment.