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:
50
README.md
50
README.md
@@ -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-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
|
- **[`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
|
## Installation
|
||||||
|
|
||||||
### Unix/Linux/macOS (Bash)
|
### Unix/Linux/macOS (Bash)
|
||||||
@@ -161,10 +201,10 @@ Export data via SOQL to CSV/JSON with optional Bulk API.
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
```bash
|
```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
|
```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
|
### sf-data-import / sf-data-import.ps1
|
||||||
@@ -173,10 +213,10 @@ Import CSV/JSON with insert/update/upsert operations.
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
```bash
|
```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
|
```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
|
### sf-logs-tail / sf-logs-tail.ps1
|
||||||
@@ -185,7 +225,7 @@ Real-time debug logs tail with filtering, levels, and Apex-only mode.
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
```bash
|
```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
|
```powershell
|
||||||
sf-logs-tail.ps1 -TargetOrg sandbox -Level DEBUG -Duration 60 -ApexOnly -Filter "MyClass"
|
sf-logs-tail.ps1 -TargetOrg sandbox -Level DEBUG -Duration 60 -ApexOnly -Filter "MyClass"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
.PARAMETER Code
|
.PARAMETER Code
|
||||||
Inline Apex code to execute (alternative to -File)
|
Inline Apex code to execute (alternative to -File)
|
||||||
|
|
||||||
.PARAMETER TargetOrg
|
.PARAMETER o
|
||||||
Target org username or alias (uses default if not specified)
|
Target org username or alias (uses default if not specified)
|
||||||
|
|
||||||
.PARAMETER Verbose
|
.PARAMETER Verbose
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\sf-apex-run.ps1 -File "scripts/setup.apex"
|
.\sf-apex-run.ps1 -File "scripts/setup.apex"
|
||||||
.\sf-apex-run.ps1 -Code "System.debug('Hello World');"
|
.\sf-apex-run.ps1 -Code "System.debug('Hello World');"
|
||||||
.\sf-apex-run.ps1 -File "test.apex" -TargetOrg "sandbox"
|
.\sf-apex-run.ps1 -File "test.apex" -o "sandbox"
|
||||||
.\sf-apex-run.ps1 -Code "Database.insert(new Account(Name='Test'));" -Verbose
|
.\sf-apex-run.ps1 -Code "Database.insert(new Account(Name='Test'));" -Verbose
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
@@ -42,7 +42,7 @@ param(
|
|||||||
[Parameter(ParameterSetName="Code")]
|
[Parameter(ParameterSetName="Code")]
|
||||||
[string]$Code,
|
[string]$Code,
|
||||||
|
|
||||||
[string]$TargetOrg,
|
[string]$o,
|
||||||
[switch]$Verbose,
|
[switch]$Verbose,
|
||||||
[switch]$Help
|
[switch]$Help
|
||||||
)
|
)
|
||||||
@@ -158,10 +158,10 @@ if ($File) {
|
|||||||
$sfArgs = @("apex", "run")
|
$sfArgs = @("apex", "run")
|
||||||
|
|
||||||
# Add target org if specified
|
# Add target org if specified
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
$sfArgs += "--target-org"
|
$sfArgs += "--target-org"
|
||||||
$sfArgs += $TargetOrg
|
$sfArgs += $o
|
||||||
Write-Host "Target org: $TargetOrg" -ForegroundColor Cyan
|
Write-Host "Target org: $o" -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add verbose flag if requested
|
# Add verbose flag if requested
|
||||||
|
|||||||
@@ -20,22 +20,22 @@ show_usage() {
|
|||||||
echo " sf-data-export [OPTIONS]"
|
echo " sf-data-export [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "OPTIONS:"
|
echo "OPTIONS:"
|
||||||
echo " -q, --query QUERY SOQL query to export data"
|
echo " -qy, --query QUERY SOQL query to export data"
|
||||||
echo " -f, --file FILE File containing SOQL query"
|
echo " -fl, --file FILE File containing SOQL query"
|
||||||
echo " -s, --sobject SOBJECT Standard object query (exports all records)"
|
echo " -so, --sobject SOBJECT Standard object query (exports all records)"
|
||||||
echo " -o, --output FILE Output file path (default: export.csv)"
|
echo " -to, --target-org ORG Target org username or alias"
|
||||||
echo " -t, --target-org ORG Target org username or alias"
|
echo " -ot, --output FILE Output file path (default: export.csv)"
|
||||||
echo " --format FORMAT Output format: csv, json (default: csv)"
|
echo " -fm, --format FORMAT Output format: csv, json (default: csv)"
|
||||||
echo " --bulk Use bulk API for large datasets"
|
echo " -bk, --bulk Use bulk API for large datasets"
|
||||||
echo " --wait MINUTES Wait time in minutes (default: 10)"
|
echo " -wt, --wait MINUTES Wait time in minutes (default: 10)"
|
||||||
echo " -v, --verbose Enable verbose output"
|
echo " -vb, --verbose Enable verbose output"
|
||||||
echo " -h, --help Show this help message"
|
echo " -hp, --help Show this help message"
|
||||||
echo ""
|
echo ""
|
||||||
echo "EXAMPLES:"
|
echo "EXAMPLES:"
|
||||||
echo " sf-data-export --query \"SELECT Id, Name FROM Account LIMIT 100\""
|
echo " sf-data-export -qy \"SELECT Id, Name FROM Account LIMIT 100\""
|
||||||
echo " sf-data-export --sobject Account --format json --output accounts.json"
|
echo " sf-data-export -so Account -fm json -ot accounts.json"
|
||||||
echo " sf-data-export --file queries/contacts.soql --bulk --wait 15"
|
echo " sf-data-export -fl queries/contacts.soql -bk -wt 15"
|
||||||
echo " sf-data-export --query \"SELECT Id FROM User\" --target-org production"
|
echo " sf-data-export -qy \"SELECT Id FROM User\" -to production"
|
||||||
echo ""
|
echo ""
|
||||||
echo "This script automatically checks for Salesforce CLI installation."
|
echo "This script automatically checks for Salesforce CLI installation."
|
||||||
}
|
}
|
||||||
@@ -123,43 +123,43 @@ VERBOSE=false
|
|||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-q|--query)
|
-qy|--query)
|
||||||
QUERY="$2"
|
QUERY="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-f|--file)
|
-fl|--file)
|
||||||
QUERY_FILE="$2"
|
QUERY_FILE="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-s|--sobject)
|
-so|--sobject)
|
||||||
SOBJECT="$2"
|
SOBJECT="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-o|--output)
|
-to|--target-org)
|
||||||
OUTPUT_FILE="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-t|--target-org)
|
|
||||||
TARGET_ORG="$2"
|
TARGET_ORG="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--format)
|
-ot|--output)
|
||||||
|
OUTPUT_FILE="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-fm|--format)
|
||||||
FORMAT="$2"
|
FORMAT="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--bulk)
|
-bk|--bulk)
|
||||||
USE_BULK=true
|
USE_BULK=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--wait)
|
-wt|--wait)
|
||||||
WAIT_TIME="$2"
|
WAIT_TIME="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-v|--verbose)
|
-vb|--verbose)
|
||||||
VERBOSE=true
|
VERBOSE=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-hp|--help)
|
||||||
show_usage
|
show_usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -9,40 +9,40 @@
|
|||||||
from Salesforce orgs with SOQL query support, multiple formats, and intelligent defaults.
|
from Salesforce orgs with SOQL query support, multiple formats, and intelligent defaults.
|
||||||
|
|
||||||
.PARAMETER Query
|
.PARAMETER Query
|
||||||
SOQL query to export data
|
SOQL query to export data (alias: -qy)
|
||||||
|
|
||||||
.PARAMETER File
|
.PARAMETER File
|
||||||
File containing SOQL query
|
File containing SOQL query (alias: -fl)
|
||||||
|
|
||||||
.PARAMETER SObject
|
.PARAMETER SObject
|
||||||
Standard object query (exports common fields)
|
Standard object query (exports common fields) (alias: -so)
|
||||||
|
|
||||||
.PARAMETER Output
|
.PARAMETER Output
|
||||||
Output file path (default: export.csv)
|
Output file path (default: export.csv) (alias: -ot)
|
||||||
|
|
||||||
.PARAMETER TargetOrg
|
.PARAMETER TargetOrg
|
||||||
Target org username or alias
|
Target org username or alias (alias: -to)
|
||||||
|
|
||||||
.PARAMETER Format
|
.PARAMETER Format
|
||||||
Output format: csv, json (default: csv)
|
Output format: csv, json (default: csv) (alias: -fm)
|
||||||
|
|
||||||
.PARAMETER Bulk
|
.PARAMETER Bulk
|
||||||
Use bulk API for large datasets
|
Use bulk API for large datasets (alias: -bk)
|
||||||
|
|
||||||
.PARAMETER Wait
|
.PARAMETER Wait
|
||||||
Wait time in minutes (default: 10)
|
Wait time in minutes (default: 10) (alias: -wt)
|
||||||
|
|
||||||
.PARAMETER Verbose
|
.PARAMETER Verbose
|
||||||
Enable verbose output
|
Enable verbose output (alias: -vb)
|
||||||
|
|
||||||
.PARAMETER Help
|
.PARAMETER Help
|
||||||
Show this help message
|
Show this help message (alias: -hp)
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\sf-data-export.ps1 -Query "SELECT Id, Name FROM Account LIMIT 100"
|
.\sf-data-export.ps1 -qy "SELECT Id, Name FROM Account LIMIT 100"
|
||||||
.\sf-data-export.ps1 -SObject Account -Format json -Output accounts.json
|
.\sf-data-export.ps1 -so Account -fm json -ot accounts.json
|
||||||
.\sf-data-export.ps1 -File queries/contacts.soql -Bulk -Wait 15
|
.\sf-data-export.ps1 -fl queries/contacts.soql -bk -wt 15
|
||||||
.\sf-data-export.ps1 -Query "SELECT Id FROM User" -TargetOrg production
|
.\sf-data-export.ps1 -qy "SELECT Id FROM User" -to production
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
This script automatically checks for Salesforce CLI installation and runs
|
This script automatically checks for Salesforce CLI installation and runs
|
||||||
@@ -51,21 +51,37 @@
|
|||||||
|
|
||||||
param(
|
param(
|
||||||
[Parameter(ParameterSetName="Query")]
|
[Parameter(ParameterSetName="Query")]
|
||||||
|
[Alias("qy")]
|
||||||
[string]$Query,
|
[string]$Query,
|
||||||
|
|
||||||
[Parameter(ParameterSetName="File")]
|
[Parameter(ParameterSetName="File")]
|
||||||
|
[Alias("fl")]
|
||||||
[string]$File,
|
[string]$File,
|
||||||
|
|
||||||
[Parameter(ParameterSetName="SObject")]
|
[Parameter(ParameterSetName="SObject")]
|
||||||
|
[Alias("so")]
|
||||||
[string]$SObject,
|
[string]$SObject,
|
||||||
|
|
||||||
|
[Alias("ot")]
|
||||||
[string]$Output = "export.csv",
|
[string]$Output = "export.csv",
|
||||||
|
|
||||||
|
[Alias("to")]
|
||||||
[string]$TargetOrg,
|
[string]$TargetOrg,
|
||||||
|
|
||||||
[ValidateSet("csv", "json")]
|
[ValidateSet("csv", "json")]
|
||||||
|
[Alias("fm")]
|
||||||
[string]$Format = "csv",
|
[string]$Format = "csv",
|
||||||
|
|
||||||
|
[Alias("bk")]
|
||||||
[switch]$Bulk,
|
[switch]$Bulk,
|
||||||
|
|
||||||
|
[Alias("wt")]
|
||||||
[int]$Wait = 10,
|
[int]$Wait = 10,
|
||||||
|
|
||||||
|
[Alias("vb")]
|
||||||
[switch]$Verbose,
|
[switch]$Verbose,
|
||||||
|
|
||||||
|
[Alias("hp")]
|
||||||
[switch]$Help
|
[switch]$Help
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -20,23 +20,23 @@ show_usage() {
|
|||||||
echo " sf-data-import [OPTIONS]"
|
echo " sf-data-import [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "OPTIONS:"
|
echo "OPTIONS:"
|
||||||
echo " -f, --file FILE CSV or JSON file to import"
|
echo " -fl, --file FILE CSV or JSON file to import"
|
||||||
echo " -s, --sobject SOBJECT Target sObject type"
|
echo " -so, --sobject SOBJECT Target sObject type"
|
||||||
echo " -o, --operation OP Operation: insert, update, upsert (default: insert)"
|
echo " -to, --target-org ORG Target org username or alias"
|
||||||
echo " -e, --external-id FIELD External ID field for upsert/update operations"
|
echo " -op, --operation OP Operation: insert, update, upsert (default: insert)"
|
||||||
echo " -t, --target-org ORG Target org username or alias"
|
echo " -ei, --external-id FIELD External ID field for upsert/update operations"
|
||||||
echo " --bulk Use bulk API for large datasets"
|
echo " -bk, --bulk Use bulk API for large datasets"
|
||||||
echo " --wait MINUTES Wait time in minutes (default: 10)"
|
echo " -wt, --wait MINUTES Wait time in minutes (default: 10)"
|
||||||
echo " --batch-size SIZE Batch size for bulk operations (default: 10000)"
|
echo " -bs, --batch-size SIZE Batch size for bulk operations (default: 10000)"
|
||||||
echo " --ignore-errors Continue on errors (don't fail entire job)"
|
echo " -ie, --ignore-errors Continue on errors (don't fail entire job)"
|
||||||
echo " -v, --verbose Enable verbose output"
|
echo " -vb, --verbose Enable verbose output"
|
||||||
echo " -h, --help Show this help message"
|
echo " -hp, --help Show this help message"
|
||||||
echo ""
|
echo ""
|
||||||
echo "EXAMPLES:"
|
echo "EXAMPLES:"
|
||||||
echo " sf-data-import --file accounts.csv --sobject Account"
|
echo " sf-data-import -fl accounts.csv -so Account"
|
||||||
echo " sf-data-import --file contacts.json --sobject Contact --operation upsert --external-id Email"
|
echo " sf-data-import -fl contacts.json -so Contact -op upsert -ei Email"
|
||||||
echo " sf-data-import --file leads.csv --sobject Lead --bulk --batch-size 5000"
|
echo " sf-data-import -fl leads.csv -so Lead -bk -bs 5000"
|
||||||
echo " sf-data-import --file updates.csv --sobject Account --operation update --external-id AccountNumber"
|
echo " sf-data-import -fl updates.csv -so Account -op update -ei AccountNumber"
|
||||||
echo ""
|
echo ""
|
||||||
echo "SUPPORTED FORMATS:"
|
echo "SUPPORTED FORMATS:"
|
||||||
echo " • CSV files with header row"
|
echo " • CSV files with header row"
|
||||||
@@ -171,47 +171,47 @@ VERBOSE=false
|
|||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-f|--file)
|
-fl|--file)
|
||||||
FILE="$2"
|
FILE="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-s|--sobject)
|
-so|--sobject)
|
||||||
SOBJECT="$2"
|
SOBJECT="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-o|--operation)
|
-to|--target-org)
|
||||||
OPERATION="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-e|--external-id)
|
|
||||||
EXTERNAL_ID="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-t|--target-org)
|
|
||||||
TARGET_ORG="$2"
|
TARGET_ORG="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--bulk)
|
-op|--operation)
|
||||||
|
OPERATION="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-ei|--external-id)
|
||||||
|
EXTERNAL_ID="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-bk|--bulk)
|
||||||
USE_BULK=true
|
USE_BULK=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--wait)
|
-wt|--wait)
|
||||||
WAIT_TIME="$2"
|
WAIT_TIME="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--batch-size)
|
-bs|--batch-size)
|
||||||
BATCH_SIZE="$2"
|
BATCH_SIZE="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--ignore-errors)
|
-ie|--ignore-errors)
|
||||||
IGNORE_ERRORS=true
|
IGNORE_ERRORS=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-v|--verbose)
|
-vb|--verbose)
|
||||||
VERBOSE=true
|
VERBOSE=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-hp|--help)
|
||||||
show_usage
|
show_usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -9,43 +9,43 @@
|
|||||||
to Salesforce orgs with CSV/JSON support, upsert operations, and intelligent validation.
|
to Salesforce orgs with CSV/JSON support, upsert operations, and intelligent validation.
|
||||||
|
|
||||||
.PARAMETER File
|
.PARAMETER File
|
||||||
CSV or JSON file to import
|
CSV or JSON file to import (alias: -fl)
|
||||||
|
|
||||||
.PARAMETER SObject
|
.PARAMETER SObject
|
||||||
Target sObject type
|
Target sObject type (alias: -so)
|
||||||
|
|
||||||
.PARAMETER Operation
|
.PARAMETER Operation
|
||||||
Operation: insert, update, upsert (default: insert)
|
Operation: insert, update, upsert (default: insert) (alias: -op)
|
||||||
|
|
||||||
.PARAMETER ExternalId
|
.PARAMETER ExternalId
|
||||||
External ID field for upsert/update operations
|
External ID field for upsert/update operations (alias: -ei)
|
||||||
|
|
||||||
.PARAMETER TargetOrg
|
.PARAMETER TargetOrg
|
||||||
Target org username or alias
|
Target org username or alias (alias: -to)
|
||||||
|
|
||||||
.PARAMETER Bulk
|
.PARAMETER Bulk
|
||||||
Use bulk API for large datasets
|
Use bulk API for large datasets (alias: -bk)
|
||||||
|
|
||||||
.PARAMETER Wait
|
.PARAMETER Wait
|
||||||
Wait time in minutes (default: 10)
|
Wait time in minutes (default: 10) (alias: -wt)
|
||||||
|
|
||||||
.PARAMETER BatchSize
|
.PARAMETER BatchSize
|
||||||
Batch size for bulk operations (default: 10000)
|
Batch size for bulk operations (default: 10000) (alias: -bs)
|
||||||
|
|
||||||
.PARAMETER IgnoreErrors
|
.PARAMETER IgnoreErrors
|
||||||
Continue on errors (don't fail entire job)
|
Continue on errors (don't fail entire job) (alias: -ie)
|
||||||
|
|
||||||
.PARAMETER Verbose
|
.PARAMETER Verbose
|
||||||
Enable verbose output
|
Enable verbose output (alias: -vb)
|
||||||
|
|
||||||
.PARAMETER Help
|
.PARAMETER Help
|
||||||
Show this help message
|
Show this help message (alias: -hp)
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\sf-data-import.ps1 -File accounts.csv -SObject Account
|
.\sf-data-import.ps1 -fl accounts.csv -so Account
|
||||||
.\sf-data-import.ps1 -File contacts.json -SObject Contact -Operation upsert -ExternalId Email
|
.\sf-data-import.ps1 -fl contacts.json -so Contact -op upsert -ei Email
|
||||||
.\sf-data-import.ps1 -File leads.csv -SObject Lead -Bulk -BatchSize 5000
|
.\sf-data-import.ps1 -fl leads.csv -so Lead -bk -bs 5000
|
||||||
.\sf-data-import.ps1 -File updates.csv -SObject Account -Operation update -ExternalId AccountNumber
|
.\sf-data-import.ps1 -fl updates.csv -so Account -op update -ei AccountNumber
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
This script automatically checks for Salesforce CLI installation and runs
|
This script automatically checks for Salesforce CLI installation and runs
|
||||||
@@ -58,21 +58,39 @@
|
|||||||
|
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
|
[Alias("fl")]
|
||||||
[string]$File,
|
[string]$File,
|
||||||
|
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
|
[Alias("so")]
|
||||||
[string]$SObject,
|
[string]$SObject,
|
||||||
|
|
||||||
[ValidateSet("insert", "update", "upsert")]
|
[ValidateSet("insert", "update", "upsert")]
|
||||||
|
[Alias("op")]
|
||||||
[string]$Operation = "insert",
|
[string]$Operation = "insert",
|
||||||
|
|
||||||
|
[Alias("ei")]
|
||||||
[string]$ExternalId,
|
[string]$ExternalId,
|
||||||
|
|
||||||
|
[Alias("to")]
|
||||||
[string]$TargetOrg,
|
[string]$TargetOrg,
|
||||||
|
|
||||||
|
[Alias("bk")]
|
||||||
[switch]$Bulk,
|
[switch]$Bulk,
|
||||||
|
|
||||||
|
[Alias("wt")]
|
||||||
[int]$Wait = 10,
|
[int]$Wait = 10,
|
||||||
|
|
||||||
|
[Alias("bs")]
|
||||||
[int]$BatchSize = 10000,
|
[int]$BatchSize = 10000,
|
||||||
|
|
||||||
|
[Alias("ie")]
|
||||||
[switch]$IgnoreErrors,
|
[switch]$IgnoreErrors,
|
||||||
|
|
||||||
|
[Alias("vb")]
|
||||||
[switch]$Verbose,
|
[switch]$Verbose,
|
||||||
|
|
||||||
|
[Alias("hp")]
|
||||||
[switch]$Help
|
[switch]$Help
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ show_usage() {
|
|||||||
echo " sf-logs-tail [OPTIONS]"
|
echo " sf-logs-tail [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "OPTIONS:"
|
echo "OPTIONS:"
|
||||||
echo " -t, --target-org ORG Target org username or alias"
|
echo " -o, --target-org ORG Target org username or alias"
|
||||||
echo " -u, --user-id USER Specific user ID to monitor (default: current user)"
|
echo " -u, --user-id USER Specific user ID to monitor (default: current user)"
|
||||||
echo " -l, --level LEVEL Log level: ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST"
|
echo " -l, --level LEVEL Log level: ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST"
|
||||||
echo " --duration MINUTES How long to tail logs in minutes (default: 30)"
|
echo " --duration MINUTES How long to tail logs in minutes (default: 30)"
|
||||||
@@ -35,7 +35,7 @@ show_usage() {
|
|||||||
echo " sf-logs-tail # Tail logs for default org"
|
echo " sf-logs-tail # Tail logs for default org"
|
||||||
echo " sf-logs-tail --level DEBUG --duration 60 # Debug level for 1 hour"
|
echo " sf-logs-tail --level DEBUG --duration 60 # Debug level for 1 hour"
|
||||||
echo " sf-logs-tail --filter \"MyClass\" --apex-only # Filter Apex logs for MyClass"
|
echo " sf-logs-tail --filter \"MyClass\" --apex-only # Filter Apex logs for MyClass"
|
||||||
echo " sf-logs-tail --target-org sandbox --user-id USER123 # Specific org and user"
|
echo " sf-logs-tail -o sandbox --user-id USER123 # Specific org and user"
|
||||||
echo ""
|
echo ""
|
||||||
echo "KEYBOARD SHORTCUTS:"
|
echo "KEYBOARD SHORTCUTS:"
|
||||||
echo " Ctrl+C Stop tailing logs and exit"
|
echo " Ctrl+C Stop tailing logs and exit"
|
||||||
@@ -153,7 +153,7 @@ VERBOSE=false
|
|||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-t|--target-org)
|
-o|--target-org)
|
||||||
TARGET_ORG="$2"
|
TARGET_ORG="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
A user-friendly wrapper around 'sf apex tail log' that provides real-time
|
A user-friendly wrapper around 'sf apex tail log' that provides real-time
|
||||||
debug log monitoring with filtering, formatting, and intelligent output colorization.
|
debug log monitoring with filtering, formatting, and intelligent output colorization.
|
||||||
|
|
||||||
.PARAMETER TargetOrg
|
.PARAMETER o
|
||||||
Target org username or alias
|
Target org username or alias
|
||||||
|
|
||||||
.PARAMETER UserId
|
.PARAMETER UserId
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
.\sf-logs-tail.ps1
|
.\sf-logs-tail.ps1
|
||||||
.\sf-logs-tail.ps1 -Level DEBUG -Duration 60
|
.\sf-logs-tail.ps1 -Level DEBUG -Duration 60
|
||||||
.\sf-logs-tail.ps1 -Filter "MyClass" -ApexOnly
|
.\sf-logs-tail.ps1 -Filter "MyClass" -ApexOnly
|
||||||
.\sf-logs-tail.ps1 -TargetOrg sandbox -UserId USER123
|
.\sf-logs-tail.ps1 -o sandbox -UserId USER123
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
This script automatically checks for Salesforce CLI installation and runs
|
This script automatically checks for Salesforce CLI installation and runs
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[string]$TargetOrg,
|
[string]$o,
|
||||||
[string]$UserId,
|
[string]$UserId,
|
||||||
[ValidateSet("ERROR", "WARN", "INFO", "DEBUG", "FINE", "FINER", "FINEST")]
|
[ValidateSet("ERROR", "WARN", "INFO", "DEBUG", "FINE", "FINER", "FINEST")]
|
||||||
[string]$Level,
|
[string]$Level,
|
||||||
@@ -190,9 +190,9 @@ if ($Duration -lt 1) {
|
|||||||
$sfArgs = @("apex", "tail", "log")
|
$sfArgs = @("apex", "tail", "log")
|
||||||
|
|
||||||
# Add optional parameters
|
# Add optional parameters
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
$sfArgs += "--target-org"
|
$sfArgs += "--target-org"
|
||||||
$sfArgs += $TargetOrg
|
$sfArgs += $o
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($UserId) {
|
if ($UserId) {
|
||||||
@@ -212,8 +212,8 @@ Set-SignalHandlers
|
|||||||
Write-Host "📡 Starting Debug Log Tail" -ForegroundColor Blue
|
Write-Host "📡 Starting Debug Log Tail" -ForegroundColor Blue
|
||||||
Write-Host "===========================" -ForegroundColor Blue
|
Write-Host "===========================" -ForegroundColor Blue
|
||||||
|
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
Write-Host "Target org: $TargetOrg" -ForegroundColor Cyan
|
Write-Host "Target org: $o" -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($UserId) {
|
if ($UserId) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
quick access to org information, limits, and authentication status with
|
quick access to org information, limits, and authentication status with
|
||||||
clean, formatted output.
|
clean, formatted output.
|
||||||
|
|
||||||
.PARAMETER TargetOrg
|
.PARAMETER o
|
||||||
Target org username or alias (uses default if not specified)
|
Target org username or alias (uses default if not specified)
|
||||||
|
|
||||||
.PARAMETER Limits
|
.PARAMETER Limits
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\sf-org-info.ps1
|
.\sf-org-info.ps1
|
||||||
.\sf-org-info.ps1 -TargetOrg "production"
|
.\sf-org-info.ps1 -o "myorg" -Limits -Verbose
|
||||||
.\sf-org-info.ps1 -Limits
|
.\sf-org-info.ps1 -Limits
|
||||||
.\sf-org-info.ps1 -ListOrgs
|
.\sf-org-info.ps1 -ListOrgs
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[string]$TargetOrg,
|
[string]$o,
|
||||||
[switch]$Limits,
|
[switch]$Limits,
|
||||||
[switch]$ListOrgs,
|
[switch]$ListOrgs,
|
||||||
[switch]$Verbose,
|
[switch]$Verbose,
|
||||||
@@ -132,10 +132,10 @@ if ($ListOrgs) {
|
|||||||
$sfArgs = @("org", "display")
|
$sfArgs = @("org", "display")
|
||||||
|
|
||||||
# Add target org if specified
|
# Add target org if specified
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
$sfArgs += "--target-org"
|
$sfArgs += "--target-org"
|
||||||
$sfArgs += $TargetOrg
|
$sfArgs += $o
|
||||||
Write-Host "Target org: $TargetOrg" -ForegroundColor Cyan
|
Write-Host "Target org: $o" -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add verbose flag if requested
|
# Add verbose flag if requested
|
||||||
@@ -158,9 +158,9 @@ if ($Limits) {
|
|||||||
# Build limits command
|
# Build limits command
|
||||||
$limitsArgs = @("org", "list", "limits")
|
$limitsArgs = @("org", "list", "limits")
|
||||||
|
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
$limitsArgs += "--target-org"
|
$limitsArgs += "--target-org"
|
||||||
$limitsArgs += $TargetOrg
|
$limitsArgs += $o
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = Invoke-SafeSfCommand $limitsArgs
|
$success = Invoke-SafeSfCommand $limitsArgs
|
||||||
@@ -186,9 +186,9 @@ if ($Verbose) {
|
|||||||
Write-Host "👤 Current User Info:" -ForegroundColor Yellow
|
Write-Host "👤 Current User Info:" -ForegroundColor Yellow
|
||||||
$userArgs = @("org", "display", "user")
|
$userArgs = @("org", "display", "user")
|
||||||
|
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
$userArgs += "--target-org"
|
$userArgs += "--target-org"
|
||||||
$userArgs += $TargetOrg
|
$userArgs += $o
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = Invoke-SafeSfCommand $userArgs
|
$success = Invoke-SafeSfCommand $userArgs
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
.PARAMETER OutputDir
|
.PARAMETER OutputDir
|
||||||
Output directory for retrieved metadata (default: current directory)
|
Output directory for retrieved metadata (default: current directory)
|
||||||
|
|
||||||
.PARAMETER TargetOrg
|
.PARAMETER o
|
||||||
Target org username or alias (uses default if not specified)
|
Target org username or alias (uses default if not specified)
|
||||||
|
|
||||||
.PARAMETER Wait
|
.PARAMETER Wait
|
||||||
@@ -33,9 +33,9 @@
|
|||||||
Show this help message
|
Show this help message
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\sf-retrieve.ps1 -MetadataTypes "ApexClass,CustomObject"
|
.\sf-retrieve.ps1 -MetadataTypes "ApexClass,CustomObject" -o myorg -OutputDir retrieved
|
||||||
.\sf-retrieve.ps1 -Manifest "manifest/package.xml"
|
.\sf-retrieve.ps1 -Manifest "manifest/package.xml"
|
||||||
.\sf-retrieve.ps1 -Package "MyPackage" -TargetOrg "myorg"
|
.\sf-retrieve.ps1 -Package "MyPackage" -o "myorg"
|
||||||
.\sf-retrieve.ps1 -MetadataTypes "Flow" -OutputDir "./retrieved" -Verbose
|
.\sf-retrieve.ps1 -MetadataTypes "Flow" -OutputDir "./retrieved" -Verbose
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
@@ -54,7 +54,7 @@ param(
|
|||||||
[string]$Package,
|
[string]$Package,
|
||||||
|
|
||||||
[string]$OutputDir,
|
[string]$OutputDir,
|
||||||
[string]$TargetOrg,
|
[string]$o,
|
||||||
[int]$Wait = 10,
|
[int]$Wait = 10,
|
||||||
[switch]$Verbose,
|
[switch]$Verbose,
|
||||||
[switch]$Help
|
[switch]$Help
|
||||||
@@ -154,10 +154,10 @@ if ($OutputDir) {
|
|||||||
$sfArgs += $OutputDir
|
$sfArgs += $OutputDir
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
$sfArgs += "--target-org"
|
$sfArgs += "--target-org"
|
||||||
$sfArgs += $TargetOrg
|
$sfArgs += $o
|
||||||
Write-Host "Target org: $TargetOrg" -ForegroundColor Cyan
|
Write-Host "Target org: $o" -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Wait -ne 10) {
|
if ($Wait -ne 10) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
.PARAMETER Wait
|
.PARAMETER Wait
|
||||||
Wait time in minutes for test execution (default: 10)
|
Wait time in minutes for test execution (default: 10)
|
||||||
|
|
||||||
.PARAMETER TargetOrg
|
.PARAMETER o
|
||||||
Target org username or alias (uses default if not specified)
|
Target org username or alias (uses default if not specified)
|
||||||
|
|
||||||
.PARAMETER OutputDir
|
.PARAMETER OutputDir
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
.\sf-test-run.ps1 -TestClasses "AccountTest,ContactTest"
|
.\sf-test-run.ps1 -TestClasses "AccountTest,ContactTest"
|
||||||
.\sf-test-run.ps1 -TestLevel "RunLocalTests" -Coverage
|
.\sf-test-run.ps1 -TestLevel "RunLocalTests" -Coverage
|
||||||
.\sf-test-run.ps1 -TestMethods "AccountTest.testCreate,ContactTest.testUpdate"
|
.\sf-test-run.ps1 -TestMethods "AccountTest.testCreate,ContactTest.testUpdate"
|
||||||
.\sf-test-run.ps1 -Suite "AllTests" -Wait 15 -TargetOrg "staging"
|
.\sf-test-run.ps1 -Suite "AllTests" -Wait 15 -o "staging"
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
This script automatically checks for Salesforce CLI installation and runs
|
This script automatically checks for Salesforce CLI installation and runs
|
||||||
@@ -65,7 +65,7 @@ param(
|
|||||||
|
|
||||||
[switch]$Coverage,
|
[switch]$Coverage,
|
||||||
[int]$Wait = 10,
|
[int]$Wait = 10,
|
||||||
[string]$TargetOrg,
|
[string]$o,
|
||||||
[string]$OutputDir,
|
[string]$OutputDir,
|
||||||
[switch]$Verbose,
|
[switch]$Verbose,
|
||||||
[switch]$Help
|
[switch]$Help
|
||||||
@@ -150,10 +150,10 @@ if ($TestClasses) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Add optional parameters
|
# Add optional parameters
|
||||||
if ($TargetOrg) {
|
if ($o) {
|
||||||
$sfArgs += "--target-org"
|
$sfArgs += "--target-org"
|
||||||
$sfArgs += $TargetOrg
|
$sfArgs += $o
|
||||||
Write-Host "Target org: $TargetOrg" -ForegroundColor Cyan
|
Write-Host "Target org: $o" -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Wait -ne 10) {
|
if ($Wait -ne 10) {
|
||||||
|
|||||||
Reference in New Issue
Block a user