mirror of
https://gitea.computerliebe.org/ComputerLiebe_ORG_private/Gitea-VSCode-Clone-Plugin.git
synced 2024-12-27 15:51:52 +00:00
* chore(README.md): Update extension name and add feature descriptions
* fix(extension.ts): Remove unused comment and change progress location to Notification * feat(extension.ts): Open cloned repository in VSCode after cloning
This commit is contained in:
parent
a23b61758b
commit
8d53bc17ed
@ -1,71 +1,39 @@
|
||||
# gitea-git-clone README
|
||||
# Gitea Clone for VSCode
|
||||
|
||||
This is the README for your extension "gitea-git-clone". After writing up a brief description, we recommend including the following sections.
|
||||
A Visual Studio Code extension that allows you to clone repositories from your Gitea instance via SSH and manage Gitea authentication using a Personal Access Token (PAT).
|
||||
|
||||
## Features
|
||||
- **Gitea Authentication**: Authenticate with your Gitea instance using a Personal Access Token.
|
||||
- **Clone via SSH**: Clone repositories from Gitea using SSH URLs.
|
||||
- **Progress Bar**: See real-time progress during the clone operation.
|
||||
- **Auto-Open Repository**: After cloning, the repository will be automatically opened in the workspace.
|
||||
|
||||
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
|
||||
|
||||
For example if there is an image subfolder under your extension project workspace:
|
||||
|
||||
\!\[feature X\]\(images/feature-x.png\)
|
||||
|
||||
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
|
||||
## Commands
|
||||
- `Gitea: Authenticate`: Authenticate with your Gitea instance using your Personal Access Token (PAT).
|
||||
- `Gitea: Configure`: Set the URL of your Gitea instance and your PAT.
|
||||
- `Gitea: Clone Repository`: Clone a repository from Gitea via SSH.
|
||||
|
||||
## Requirements
|
||||
- A Gitea instance with SSH access.
|
||||
- A Personal Access Token (PAT) from your Gitea instance for authentication.
|
||||
|
||||
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
|
||||
## Configuration
|
||||
You can configure the Gitea instance URL and your Personal Access Token in your VSCode settings:
|
||||
|
||||
## Extension Settings
|
||||
```json
|
||||
{
|
||||
"gitea.instanceUrl": "https://your-gitea-instance.com",
|
||||
"gitea.personalAccessToken": "your-personal-access-token"
|
||||
}
|
||||
````
|
||||
|
||||
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
|
||||
## Usage
|
||||
|
||||
For example:
|
||||
Run Gitea: Authenticate to authenticate with your Gitea instance.
|
||||
Run Gitea: Clone Repository to clone a repository from your Gitea account.
|
||||
Choose the repository you want to clone and select the folder where you want to clone it.
|
||||
The repository will be cloned via SSH and automatically opened in VSCode.
|
||||
|
||||
This extension contributes the following settings:
|
||||
## Issues
|
||||
|
||||
* `myExtension.enable`: Enable/disable this extension.
|
||||
* `myExtension.thing`: Set to `blah` to do something.
|
||||
|
||||
## Known Issues
|
||||
|
||||
Calling out known issues can help limit users opening duplicate issues against your extension.
|
||||
|
||||
## Release Notes
|
||||
|
||||
Users appreciate release notes as you update your extension.
|
||||
|
||||
### 1.0.0
|
||||
|
||||
Initial release of ...
|
||||
|
||||
### 1.0.1
|
||||
|
||||
Fixed issue #.
|
||||
|
||||
### 1.1.0
|
||||
|
||||
Added features X, Y, and Z.
|
||||
|
||||
---
|
||||
|
||||
## Following extension guidelines
|
||||
|
||||
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
|
||||
|
||||
* [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)
|
||||
|
||||
## Working with Markdown
|
||||
|
||||
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
|
||||
|
||||
* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
|
||||
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
|
||||
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
|
||||
|
||||
## For more information
|
||||
|
||||
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
|
||||
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
|
||||
|
||||
**Enjoy!**
|
||||
If you encounter any issues or have feature requests, please feel free to submit them in the issues section.
|
@ -99,7 +99,6 @@ async function cloneGiteaRepository() {
|
||||
|
||||
const repo = repos.find(r => r.full_name === selectedRepo);
|
||||
|
||||
// Verwende die SSH-URL anstelle von HTTPS
|
||||
if (repo && repo.ssh_url) {
|
||||
const folderUri = await vscode.window.showOpenDialog({
|
||||
canSelectFiles: false,
|
||||
@ -112,20 +111,33 @@ async function cloneGiteaRepository() {
|
||||
const folderPath = folderUri[0].fsPath;
|
||||
|
||||
vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: `Cloning ${selectedRepo}`,
|
||||
cancellable: false
|
||||
}, async (progress) => {
|
||||
progress.report({ message: 'Klonvorgang läuft...' });
|
||||
}, async (progress, token) => {
|
||||
progress.report({ message: 'Klonvorgang läuft...', increment: 0 });
|
||||
|
||||
exec(`git clone ${repo.ssh_url} ${folderPath}`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
vscode.window.showErrorMessage('Fehler beim Klonen des Repositories.');
|
||||
console.error(stderr);
|
||||
} else {
|
||||
vscode.window.showInformationMessage(`Repository ${selectedRepo} erfolgreich geklont.`);
|
||||
console.log(stdout);
|
||||
}
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
exec(`git clone ${repo.ssh_url} ${folderPath}`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
vscode.window.showErrorMessage('Fehler beim Klonen des Repositories.');
|
||||
console.error(stderr);
|
||||
reject(error);
|
||||
} else {
|
||||
progress.report({ message: 'Repository geklont.', increment: 100 });
|
||||
vscode.window.showInformationMessage(`Repository ${selectedRepo} erfolgreich geklont.`);
|
||||
|
||||
// Öffne das geklonte Repository im VSCode
|
||||
try {
|
||||
vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(folderPath), true)
|
||||
.then(() => resolve());
|
||||
} catch (err: unknown) {
|
||||
vscode.window.showErrorMessage('Fehler beim Öffnen des geklonten Repositories.');
|
||||
console.error(err);
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user