gitea-cli/README.md

84 lines
2.0 KiB
Markdown

# Gitea CLI
A command line interface for interacting with Gitea servers.
## Installation
1. Clone this repository
2. Install dependencies:
```bash
pip install -r requirements.txt
```
## Configuration
You can configure the Gitea CLI in two ways:
### 1. Environment Variables
Set the following environment variables:
```bash
export GITEA_URL=https://your-gitea-instance.com
export GITEA_TOKEN=your_access_token
```
### 2. Command Line Arguments
Alternatively, provide the configuration via command line arguments:
```bash
python gitea_cli.py create-repo --gitea-url https://your-gitea-instance.com --gitea-token your_access_token --name my-repo
```
To get an access token:
1. Log into your Gitea instance
2. Go to Settings > Applications
3. Generate a new token
## Usage
### Create a new repository:
```bash
python gitea_cli.py create-repo --name my-repo --description "My new repository" --private
```
### Create a repository and set it as remote:
If you're in a git repository and want to create a new Gitea repository and set it as the remote origin:
```bash
python gitea_cli.py create-repo --name my-repo --description "My new repository" --set-remote
```
### List repositories for a user:
```bash
python gitea_cli.py list-repos --user USERNAME
```
With pagination:
```bash
python gitea_cli.py list-repos --user USERNAME --page 2 --limit 50
```
### Search repositories:
Basic name search:
```bash
python gitea_cli.py search-repos --user USERNAME --query "search term"
```
Search descriptions:
```bash
python gitea_cli.py search-repos --user USERNAME --query "term" --search-in description
```
Filter by private status:
```bash
python gitea_cli.py search-repos --user USERNAME --private true
```
Combined search with pagination:
```bash
python gitea_cli.py search-repos --user USERNAME --query "project" --search-in both --private false --page 2 --limit 50
```
### Toggle repository visibility:
```bash
python gitea_cli.py mode --name REPO_NAME --public
python gitea_cli.py mode --name REPO_NAME --private
```