Implement innovative two-character option scheme

- Replace single-character options with memorable two-character alternatives
- Based on syllable mapping: -to (target-org), -qy (query), -fm (format), etc.
- Updated all bash and PowerShell scripts with consistent options
- Added comprehensive documentation and examples to README.md
- Maintains backward compatibility with long options
- More intuitive and self-documenting than traditional CLI options
This commit is contained in:
reynold
2025-08-28 18:11:08 +08:00
parent d919e5cfb8
commit 628fe95b50
11 changed files with 206 additions and 132 deletions

View File

@@ -28,6 +28,46 @@ Data and logs:
- **[`sf-data-import` / `sf-data-import.ps1`](#sf-data-import--sf-data-importps1)** - Import CSV/JSON with insert/update/upsert
- **[`sf-logs-tail` / `sf-logs-tail.ps1`](#sf-logs-tail--sf-logs-tailps1)** - Real-time debug logs tail with filtering
## Two-Character Option Scheme
All scripts use an innovative **two-character option scheme** based on syllables, making options more memorable and self-documenting than traditional single-character flags:
### Core Options (consistent across scripts)
- `-to, --target-org` - **T**arget **O**rg
- `-hp, --help` - **H**el**P**
- `-vb, --verbose` - **V**er**B**ose
### File & I/O Options
- `-fl, --file` - **F**i**L**e
- `-ot, --output` - **O**u**T**put
- `-fm, --format` - **F**or**M**at
### Data & Query Options
- `-qy, --query` - **Q**uer**Y**
- `-so, --sobject` - **S**-**O**bject
- `-bk, --bulk` - **B**ul**K**
### Operation & Control Options
- `-op, --operation` - **Op**eration
- `-wt, --wait` - **W**ai**T**
- `-lv, --level` - **L**e**V**el
### Benefits
- **More Memorable**: `-to` for target-org is intuitive vs cryptic `-o`
- **Self-Documenting**: Users can often guess what `-fm` means (format)
- **No Conflicts**: Two characters eliminates option conflicts between scripts
- **Consistent**: Same long option always maps to same short option across all scripts
- **Scalable**: Room for many more options without running out of meaningful combinations
### Example Usage
```bash
# Traditional approach would be:
# sf-data-export -q "SELECT Id FROM Account" -o myorg -f csv
# Our approach:
sf-data-export -qy "SELECT Id FROM Account" -to myorg -fm csv
```
## Installation
### Unix/Linux/macOS (Bash)
@@ -161,10 +201,10 @@ Export data via SOQL to CSV/JSON with optional Bulk API.
Usage:
```bash
sf-data-export --query "SELECT Id, Name FROM Account" | --file query.soql | --sobject Account [--format csv|json] [--bulk] [--output out.csv]
sf-data-export -qy "SELECT Id, Name FROM Account" | -fl query.soql | -so Account [-to ORG] [-fm csv|json] [-bk] [-ot out.csv]
```
```powershell
sf-data-export.ps1 -Query "SELECT Id FROM User" -Format json -Output users.json
sf-data-export.ps1 -qy "SELECT Id FROM User" -fm json -ot users.json
```
### sf-data-import / sf-data-import.ps1
@@ -173,10 +213,10 @@ Import CSV/JSON with insert/update/upsert operations.
Usage:
```bash
sf-data-import --file data.csv --sobject Account --operation insert|update|upsert [--external-id Field] [--bulk]
sf-data-import -fl data.csv -so Account [-to ORG] [-op insert|update|upsert] [-ei Field] [-bk]
```
```powershell
sf-data-import.ps1 -File data.json -SObject Contact -Operation upsert -ExternalId Email
sf-data-import.ps1 -fl data.json -so Contact -op upsert -ei Email
```
### sf-logs-tail / sf-logs-tail.ps1
@@ -185,7 +225,7 @@ Real-time debug logs tail with filtering, levels, and Apex-only mode.
Usage:
```bash
sf-logs-tail [--target-org ORG] [--user-id USER] [--level DEBUG] [--duration 60] [--filter PATTERN] [--apex-only]
sf-logs-tail [-o ORG] [--user-id USER] [--level DEBUG] [--duration 60] [--filter PATTERN] [--apex-only]
```
```powershell
sf-logs-tail.ps1 -TargetOrg sandbox -Level DEBUG -Duration 60 -ApexOnly -Filter "MyClass"