mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Git-UI extension for Git credentials (#74461)
This commit is contained in:
parent
f2d54affc1
commit
21aa8afdd0
8
extensions/git-ui/.vscodeignore
Normal file
8
extensions/git-ui/.vscodeignore
Normal file
|
@ -0,0 +1,8 @@
|
|||
src/**
|
||||
test/**
|
||||
out/**
|
||||
tsconfig.json
|
||||
build/**
|
||||
extension.webpack.config.js
|
||||
cgmanifest.json
|
||||
yarn.lock
|
7
extensions/git-ui/README.md
Normal file
7
extensions/git-ui/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Git UI integration for Visual Studio Code
|
||||
|
||||
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
|
||||
|
||||
## Features
|
||||
|
||||
See [Git support in VS Code](https://code.visualstudio.com/docs/editor/versioncontrol#_git-support) to learn about the features of this extension.
|
4
extensions/git-ui/cgmanifest.json
Normal file
4
extensions/git-ui/cgmanifest.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"registrations": [],
|
||||
"version": 1
|
||||
}
|
17
extensions/git-ui/extension.webpack.config.js
Normal file
17
extensions/git-ui/extension.webpack.config.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
|
||||
'use strict';
|
||||
|
||||
const withDefaults = require('../shared.webpack.config');
|
||||
|
||||
module.exports = withDefaults({
|
||||
context: __dirname,
|
||||
entry: {
|
||||
main: './src/main.ts'
|
||||
}
|
||||
});
|
28
extensions/git-ui/package.json
Normal file
28
extensions/git-ui/package.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "git-ui",
|
||||
"displayName": "%displayName%",
|
||||
"description": "%description%",
|
||||
"publisher": "vscode",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"vscode": "^1.5.0"
|
||||
},
|
||||
"extensionKind": "ui",
|
||||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
|
||||
"enableProposedApi": true,
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onCommand:git.credential"
|
||||
],
|
||||
"main": "./out/main",
|
||||
"icon": "resources/icons/git.png",
|
||||
"scripts": {
|
||||
"compile": "gulp compile-extension:git-ui",
|
||||
"watch": "gulp watch-extension:git-ui"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.12.21"
|
||||
}
|
||||
}
|
4
extensions/git-ui/package.nls.json
Normal file
4
extensions/git-ui/package.nls.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"displayName": "Git UI",
|
||||
"description": "Git SCM UI Integration"
|
||||
}
|
BIN
extensions/git-ui/resources/icons/git.png
Normal file
BIN
extensions/git-ui/resources/icons/git.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
57
extensions/git-ui/src/main.ts
Normal file
57
extensions/git-ui/src/main.ts
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ExtensionContext, commands } from 'vscode';
|
||||
|
||||
import * as cp from 'child_process';
|
||||
|
||||
export async function deactivate(): Promise<any> {
|
||||
}
|
||||
|
||||
export async function activate(context: ExtensionContext): Promise<void> {
|
||||
context.subscriptions.push(commands.registerCommand('git.credential', async (data: any) => {
|
||||
try {
|
||||
const { stdout, stderr } = await exec(`git credential ${data.command}`, {
|
||||
stdin: data.stdin,
|
||||
env: Object.assign(process.env, { GIT_TERMINAL_PROMPT: '0' })
|
||||
});
|
||||
return { stdout, stderr, code: 0 };
|
||||
} catch ({ stdout, stderr, error }) {
|
||||
const code = error.code || 0;
|
||||
if (stderr.indexOf('terminal prompts disabled') !== -1) {
|
||||
stderr = '';
|
||||
}
|
||||
return { stdout, stderr, code };
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
export interface ExecResult {
|
||||
error: Error | null;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
}
|
||||
|
||||
|
||||
export function exec(command: string, options: cp.ExecOptions & { stdin?: string } = {}) {
|
||||
return new Promise<ExecResult>((resolve, reject) => {
|
||||
const child = cp.exec(command, options, (error, stdout, stderr) => {
|
||||
(error ? reject : resolve)({ error, stdout, stderr });
|
||||
});
|
||||
if (options.stdin) {
|
||||
child.stdin.write(options.stdin, (err: any) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
child.stdin.end((err: any) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
8
extensions/git-ui/src/typings/refs.d.ts
vendored
Normal file
8
extensions/git-ui/src/typings/refs.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='../../../../src/vs/vscode.d.ts'/>
|
||||
/// <reference path='../../../../src/vs/vscode.proposed.d.ts'/>
|
||||
/// <reference types='@types/node'/>
|
13
extensions/git-ui/tsconfig.json
Normal file
13
extensions/git-ui/tsconfig.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../shared.tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out",
|
||||
"experimentalDecorators": true,
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
8
extensions/git-ui/yarn.lock
Normal file
8
extensions/git-ui/yarn.lock
Normal file
|
@ -0,0 +1,8 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/node@^10.12.21":
|
||||
version "10.14.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.7.tgz#1854f0a9aa8d2cd6818d607b3d091346c6730362"
|
||||
integrity sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==
|
Loading…
Reference in a new issue