docs: update README with config file usage

Replace command-line credential options and environment variables
with config file documentation. Add the new `running` command and
update all examples to use the required --server option.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 14:37:19 +08:00
parent d88cedc8a0
commit ba4bd785aa

View File

@@ -25,48 +25,54 @@ uv run zzpyjenkins --help
## Configuration
You can provide Jenkins credentials via command-line options or environment variables:
Create a config file at `~/.config/zzpyjenkins/config.toml` with your Jenkins server configurations:
### Command-line options (preferred)
```toml
[work]
url = "https://jenkins.work.com"
username = "myuser"
password = "my-api-token"
```bash
zzpyjenkins -u https://jenkins.example.com -U username -P token info
[home]
url = "http://localhost:8080"
username = "admin"
password = "admin123"
```
### Environment variables
```bash
export JENKINS_URL="https://your-jenkins-server.com"
export JENKINS_USERNAME="your_username"
export JENKINS_PASSWORD="your_api_token" # or JENKINS_TOKEN
```
Use the `-s/--server` option to select which server to use.
## Usage
```bash
# Show Jenkins server info
zzpyjenkins info
zzpyjenkins -s work info
# List all jobs
zzpyjenkins list
zzpyjenkins -s work list
# List jobs with filter
zzpyjenkins list -p "my-project"
zzpyjenkins -s work list -p "my-project"
# Trigger a build
zzpyjenkins build my-job-name
zzpyjenkins -s work build my-job-name
# Trigger a build with parameters
zzpyjenkins build my-job-name -p BRANCH=main -p ENV=staging
zzpyjenkins -s work build my-job-name -p BRANCH=main -p ENV=staging
# Get build status
zzpyjenkins status my-job-name
zzpyjenkins -s work status my-job-name
# Get specific build status
zzpyjenkins status my-job-name 123
zzpyjenkins -s work status my-job-name 123
# Watch build progress
zzpyjenkins watch my-job-name
zzpyjenkins -s work watch my-job-name
# List running jobs
zzpyjenkins -s work running
# Show only count of running jobs
zzpyjenkins -s work running -c
```
## Development