Skip to content

Commit

Permalink
Add tab step to customise increment varname
Browse files Browse the repository at this point in the history
  • Loading branch information
Cydroz authored and andyleejordan committed Jan 10, 2025
1 parent 01cc9fe commit 0c5f2f8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions snippets/PowerShell.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,16 @@
"description": "Insert a foreach loop with Write-Progress initialized",
"body": [
"\\$total = \\$${1:array}.count",
"\\$i = 1",
"\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
"Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
"\\$${4:i} = 1",
"\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$${4:i}/\\$total,4) * 100)",
"Write-Progress -Activity \"${3:activityName}\" -Status \"\\$${4:i} of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
"foreach ($${2:item} in $${1:array}) {",
" \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
" Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
" \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$${4:i}/\\$total,4) * 100)",
" Write-Progress -Activity \"${3:activityName}\" -Status \"\\$${4:i} of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
" # Insert Code Here",
" ${0}",
" ",
" \\$i++",
" \\$${4:i}++",
"}",
""
]
Expand Down

0 comments on commit 0c5f2f8

Please sign in to comment.