From 3e24d62fb26825467ed07fe64994d545b32e9719 Mon Sep 17 00:00:00 2001 From: reynold Date: Thu, 28 Aug 2025 18:21:49 +0800 Subject: [PATCH] Remove outdated Windows PowerShell examples section from README - Removed Windows PowerShell Examples section that contained old command patterns - Replaced with concise Quick Start Examples using current two-character options - All examples now reflect the modern command structure and syntax - Maintains consistency with updated wrapper script functionality --- README.md | 189 +++++++++++++++++++++++------------------------------- 1 file changed, 82 insertions(+), 107 deletions(-) diff --git a/README.md b/README.md index 392f0ff..a7fdfea 100644 --- a/README.md +++ b/README.md @@ -129,70 +129,109 @@ Set-Alias sf-logs-tail "C:\\path\\to\\sf-cli-wrapper\\sf-logs-tail.ps1" ## Scripts -### sf-org-create +### sf-org-create / sf-org-create.ps1 Smart scratch org creation with templates and intelligent defaults. -Usage (bash): +**Usage:** ```bash -sf-org-create [-a ALIAS] [-d DAYS] [-t TEMPLATE] [--no-namespace] +sf-org-create -al ALIAS -dd DAYS -df TEMPLATE [--no-namespace] ``` - -Usage (PowerShell): ```powershell -sf-org-create.ps1 -Alias "MySO" -DurationDays 7 -Template "config/project-scratch-def.json" +sf-org-create.ps1 -al "MySO" -dd 7 -df "config/project-scratch-def.json" ``` -Examples: -- Create with alias and duration: `sf-org-create -a SO -d 7` -- Use a specific template: `sf-org-create -t config/project-scratch-def.json` +**Examples:** +```bash +# Create scratch org with alias and 7-day duration +sf-org-create -al MyScratch -dd 7 + +# Use specific definition file +sf-org-create -al DevOrg -df config/project-scratch-def.json +``` ### sf-org-info / sf-org-info.ps1 -Quick org information display with optional limits and listing authenticated orgs. +Display org information, limits, and list authenticated orgs. -Usage: +**Usage:** ```bash -sf-org-info [-o ORG] [--limits] [--list] +sf-org-info -to ORG [--limits] [--list] [-vb] ``` ```powershell -sf-org-info.ps1 -TargetOrg "myorg" -Limits -Verbose +sf-org-info.ps1 -to "myorg" -Limits -vb +``` + +**Examples:** +```bash +# Show org info for specific org +sf-org-info -to MyOrg + +# Show limits and verbose info +sf-org-info -to MyOrg --limits -vb ``` ### sf-retrieve / sf-retrieve.ps1 -Streamlined metadata retrieval supporting metadata types, manifest, and package name. +Retrieve metadata from orgs using types, manifests, or package names. -Usage: +**Usage:** ```bash -sf-retrieve --types "ApexClass,CustomObject" | --manifest manifest/package.xml | --package-name MyPkg [--target-org ORG] [--output-dir DIR] +sf-retrieve -tp "ApexClass,CustomObject" | -mn manifest/package.xml | -pn MyPkg [-to ORG] [-od DIR] ``` ```powershell -sf-retrieve.ps1 -MetadataTypes "ApexClass,CustomObject" -TargetOrg myorg -OutputDir retrieved +sf-retrieve.ps1 -tp "ApexClass,CustomObject" -to myorg -od retrieved +``` + +**Examples:** +```bash +# Retrieve specific metadata types +sf-retrieve -tp "ApexClass,CustomObject" -to MyOrg + +# Use manifest file +sf-retrieve -mn manifest/package.xml -to MyOrg -od ./metadata ``` ### sf-test-run / sf-test-run.ps1 -Focused Apex test execution with better formatting, coverage, and wait control. +Run Apex tests with coverage reporting and flexible targeting. -Usage: +**Usage:** ```bash -sf-test-run --classes "A,B" | --methods "A.m1,B.m2" | --level RunLocalTests [--coverage] [--wait 15] [--target-org ORG] +sf-test-run -to ORG [-cn "Class1,Class2"] [-lv RunLocalTests] [-cv] [-wt 15] ``` ```powershell -sf-test-run.ps1 -TestClasses "ApexTest1,ApexTest2" -Coverage -Wait 15 +sf-test-run.ps1 -to MyOrg -cn "ApexTest1,ApexTest2" -cv -wt 15 +``` + +**Examples:** +```bash +# Run specific test classes with coverage +sf-test-run -to MyOrg -cn "MyTest,AnotherTest" -cv + +# Run all local tests +sf-test-run -to MyOrg -lv RunLocalTests ``` ### sf-apex-run / sf-apex-run.ps1 -Execute anonymous Apex from file or inline code. +Execute anonymous Apex code from files or inline. -Usage: +**Usage:** ```bash -sf-apex-run --file scripts/setup.apex | --code "System.debug('hi');" [--target-org ORG] +sf-apex-run -fl scripts/setup.apex | --code "System.debug('hi');" [-to ORG] ``` ```powershell -sf-apex-run.ps1 -File "scripts/setup.apex" -TargetOrg dev +sf-apex-run.ps1 -fl "scripts/setup.apex" -to dev +``` + +**Examples:** +```bash +# Execute Apex from file +sf-apex-run -fl scripts/data-setup.apex -to MyOrg + +# Execute inline code +sf-apex-run --code "System.debug('Hello World');" -to MyOrg ``` ### sf-data-export / sf-data-export.ps1 @@ -387,95 +426,31 @@ Running environment check to help you get started... - **Cross-Platform**: Same experience on Bash and PowerShell - **User-Friendly**: Clear error messages and actionable guidance -## Windows PowerShell Examples +## Quick Start Examples -For Windows users, here are the PowerShell equivalents of the bash examples: +### Data Operations +```bash +# Export Account data to CSV with two-character options +sf-data-export -qy "SELECT Id, Name FROM Account LIMIT 100" -to MyOrg -fm csv -### sf-deploy.ps1 +# Import CSV data using bulk API +sf-data-import -fl accounts.csv -so Account -to MyOrg -bk -```powershell -# Deploy multiple flexipages (specific files) -sf-deploy.ps1 -o "DEMO-ORG" ` - -s "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Page_Backup_With_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml" - -# Deploy entire directory -sf-deploy.ps1 -o "DEMO-ORG" -d "force-app/main/default/classes" - -# Deploy with specific tests -sf-deploy.ps1 -o "DEMO-ORG" ` - -s "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" ` - -t "SelectorOpportunity_Test,SelectorOpportunity2_Test" +# Upsert contacts with external ID +sf-data-import -fl contacts.csv -so Contact -op upsert -ei Email -to MyOrg ``` -### sf-dry-run.ps1 +### Development Workflow +```bash +# 1. Create scratch org +sf-org-create -al MyScratch -dd 7 -```powershell -# Validate multiple flexipages (specific files) -sf-dry-run.ps1 -o "DEMO-ORG" ` - -s "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml" +# 2. Deploy and test +sf-deploy -to MyScratch -d "force-app/main/default/classes" +sf-test-run -to MyScratch -lv RunLocalTests -cv -# Validate entire directory -sf-dry-run.ps1 -o "DEMO-ORG" -d "force-app/main/default/classes" - -# Validate with specific tests -sf-dry-run.ps1 -o "DEMO-ORG" ` - -s "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" ` - -t "SelectorOpportunity_Test,SelectorOpportunity2_Test" -``` - -### sf-web-open.ps1 - -```powershell -# Open a specific org (default home) -sf-web-open.ps1 -o "DEMO-ORG" - -# Open Setup Home of a target org -sf-web-open.ps1 -o "NUSHUB-DR2" -p "/lightning/setup/SetupOneHome/home" - -# Get just the URL for scripting -sf-web-open.ps1 -o "NUSHUB-DR2" -U - -# Open the current default org -sf-web-open.ps1 -``` - -### Windows Common Workflows - -Additional helpers (PowerShell): -```powershell -# Org creation -sf-org-create.ps1 -Alias "SO" -DurationDays 7 - -# Retrieve metadata -sf-retrieve.ps1 -Manifest "manifest/package.xml" -TargetOrg "dev" - -# Run tests with coverage -sf-test-run.ps1 -TestLevel RunLocalTests -Coverage -Wait 15 - -# Execute anonymous Apex -sf-apex-run.ps1 -Code "System.debug('Hello');" -TargetOrg dev - -# Data export and import -sf-data-export.ps1 -SObject Account -Format csv -Output accounts.csv -sf-data-import.ps1 -File accounts.csv -SObject Account -Operation insert - -# Tail logs -sf-logs-tail.ps1 -Level DEBUG -Duration 30 -ApexOnly -``` - -```powershell -# 1. First, validate your deployment (specific file) -sf-dry-run.ps1 -o "DEMO-ORG" -s "force-app/main/default/classes/MyClass.cls" - -# 2. If validation passes, deploy for real -sf-deploy.ps1 -o "DEMO-ORG" -s "force-app/main/default/classes/MyClass.cls" - -# 3. Open the org to verify changes -sf-web-open.ps1 -o "DEMO-ORG" - -# Alternative: Deploy entire directory -sf-dry-run.ps1 -o "DEMO-ORG" -d "force-app/main/default/classes" -sf-deploy.ps1 -o "DEMO-ORG" -d "force-app/main/default/classes" +# 3. Retrieve changes +sf-retrieve -tp "ApexClass" -to MyScratch ``` ## Prerequisites