Add Gitea alias and setup function
This commit is contained in:
45
README.md
45
README.md
@@ -24,15 +24,16 @@ A command line tool to create repositories on Gitea servers with automatic git s
|
||||
2. Install dependencies: `npm install`
|
||||
3. Build the project: `npm run build`
|
||||
4. Link globally: `npm link`
|
||||
5. Use `gitea-creator` command anywhere
|
||||
5. Use `gitea-creator` or `gitea` command anywhere
|
||||
|
||||
### Option 3: Global Installation (from npm)
|
||||
```bash
|
||||
# If published to npm
|
||||
npm install -g gitea-creator
|
||||
|
||||
# Use anywhere
|
||||
# Use anywhere with either command
|
||||
gitea-creator my-repo --public
|
||||
gitea my-repo --public # Short alias
|
||||
```
|
||||
|
||||
### Option 4: Direct Usage
|
||||
@@ -58,7 +59,18 @@ cp env.example .env
|
||||
### For Global Installation
|
||||
When installed globally, the tool supports multiple configuration methods:
|
||||
|
||||
#### Option 1: System Environment Variables (Recommended)
|
||||
#### Option 1: Automated Setup (Easiest!)
|
||||
```bash
|
||||
# Interactive setup - adds environment variables to your shell profile
|
||||
gitea --setup
|
||||
# or
|
||||
gitea-creator --setup
|
||||
|
||||
# Follow the prompts, then reload your shell:
|
||||
source ~/.zshrc # or ~/.bashrc
|
||||
```
|
||||
|
||||
#### Option 2: Manual Environment Variables
|
||||
```bash
|
||||
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
|
||||
export GITEA_TOKEN=your_gitea_access_token
|
||||
@@ -68,7 +80,7 @@ export GITEA_API_URL=https://your-gitea-server.com/api/v1
|
||||
source ~/.zshrc # or ~/.bashrc
|
||||
```
|
||||
|
||||
#### Option 2: Global Configuration File
|
||||
#### Option 3: Global Configuration File
|
||||
```bash
|
||||
# Create global config directory
|
||||
mkdir -p ~/.gitea-creator
|
||||
@@ -78,12 +90,12 @@ echo "GITEA_TOKEN=your_token_here" > ~/.gitea-creator/.env
|
||||
echo "GITEA_API_URL=https://your-gitea-server.com/api/v1" >> ~/.gitea-creator/.env
|
||||
```
|
||||
|
||||
#### Option 3: View Configuration Instructions
|
||||
#### Option 4: View Configuration Instructions
|
||||
```bash
|
||||
# Get setup instructions anytime
|
||||
gitea --config
|
||||
# or
|
||||
gitea-creator --config
|
||||
# or short form
|
||||
gitea-creator -c
|
||||
```
|
||||
|
||||
### Getting a Gitea Access Token
|
||||
@@ -96,6 +108,8 @@ gitea-creator -c
|
||||
|
||||
```bash
|
||||
gitea-creator <repository-name> [options]
|
||||
# or use the short alias
|
||||
gitea <repository-name> [options]
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -103,26 +117,31 @@ gitea-creator <repository-name> [options]
|
||||
- `-p, --public`: Create a public repository (non-private)
|
||||
- `-d, --description <description>`: Add a description to the repository
|
||||
- `--https`: Use HTTPS URL instead of SSH URL (SSH is default)
|
||||
- `--setup`: Interactive setup for shell environment variables
|
||||
- `-c, --config`: Show configuration setup instructions
|
||||
- `-h, --help`: Display help information
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Setup environment variables (first time only)
|
||||
gitea --setup
|
||||
|
||||
# Create a private repository (SSH URL by default)
|
||||
gitea-creator my-new-repo
|
||||
gitea my-new-repo
|
||||
gitea-creator my-new-repo # Same thing
|
||||
|
||||
# Create a public repository with description
|
||||
gitea-creator my-public-repo --public --description "My awesome project"
|
||||
gitea my-public-repo --public --description "My awesome project"
|
||||
|
||||
# Create with HTTPS URL instead of SSH
|
||||
gitea-creator my-repo --https
|
||||
gitea my-repo --https
|
||||
|
||||
# Combine options
|
||||
gitea-creator my-repo -p -d "Short description" --https
|
||||
gitea my-repo -p -d "Short description" --https
|
||||
|
||||
# Get configuration help
|
||||
gitea-creator --config
|
||||
gitea --config
|
||||
```
|
||||
|
||||
## Workflow
|
||||
@@ -159,6 +178,8 @@ npm run dev
|
||||
|
||||
# Test the CLI
|
||||
node dist/index.js my-test-repo --public
|
||||
# or if linked globally
|
||||
gitea my-test-repo --public
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
Reference in New Issue
Block a user