Skip to content

Commit dce2c45

Browse files
StartAutomatingStartAutomating
authored andcommitted
New-PipeScript: Trimming whitespace
1 parent 34e8eb1 commit dce2c45

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

Transpilers/Syntax/README.md

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
This directory and it's subdirectories contain syntax changes that enable common programming scenarios in PowerShell and PipeScript.
22

33

4-
|DisplayName |Synopsis |
5-
|------------------------------------------|------------------------------------------------------|
6-
|[Dot](Dot.psx.ps1) |[Dot Notation](Dot.psx.ps1) |
7-
|[PipedAssignment](PipedAssignment.psx.ps1)|[Piped Assignment Transpiler](PipedAssignment.psx.ps1)|
8-
|[RegexLiteral](RegexLiteral.psx.ps1) |[Regex Literal Transpiler](RegexLiteral.psx.ps1) |
4+
|DisplayName |Synopsis |
5+
|------------------------------------------------|---------------------------------------------------------|
6+
|[Dot](Dot.psx.ps1) |[Dot Notation](Dot.psx.ps1) |
7+
|[EqualityComparison](EqualityComparison.psx.ps1)|[Allows equality comparison.](EqualityComparison.psx.ps1)|
8+
|[PipedAssignment](PipedAssignment.psx.ps1) |[Piped Assignment Transpiler](PipedAssignment.psx.ps1) |
9+
|[RegexLiteral](RegexLiteral.psx.ps1) |[Regex Literal Transpiler](RegexLiteral.psx.ps1) |
910

1011

1112

@@ -15,43 +16,45 @@ This directory and it's subdirectories contain syntax changes that enable common
1516

1617
~~~PowerShell
1718
.> {
18-
[DateTime]::now |
19+
[DateTime]::now | .Month .Day .Year
20+
}
1921
~~~
2022

2123
## Dot Example 2
2224

2325

2426
~~~PowerShell
2527
.> {
26-
"abc", "123", "abc123" |
28+
"abc", "123", "abc123" | .Length
29+
}
2730
~~~
2831

2932
## Dot Example 3
3033

3134

3235
~~~PowerShell
33-
.> { 1
36+
.> { 1.99 | .ToString 'C' [CultureInfo]'gb-gb' }
3437
~~~
3538

3639
## Dot Example 4
3740

3841

3942
~~~PowerShell
40-
.> { 1
43+
.> { 1.99 | .ToString('C') }
4144
~~~
4245

4346
## Dot Example 5
4447

4548

4649
~~~PowerShell
47-
.> { 1.
50+
.> { 1..5 | .Number { $_ } .Even { -not ($_ % 2) } .Odd { ($_ % 2) -as [bool]} }
4851
~~~
4952

5053
## Dot Example 6
5154

5255

5356
~~~PowerShell
54-
.> {
57+
.> { .ID { Get-Random } .Count { 0 } .Total { 10 }}
5558
~~~
5659

5760
## Dot Example 7
@@ -60,6 +63,36 @@ This directory and it's subdirectories contain syntax changes that enable common
6063
~~~PowerShell
6164
.> {
6265
# Declare a new object
66+
.Property = "ConstantValue" .Numbers = 1..100 .Double = {
67+
param($n)
68+
$n * 2
69+
} .EvenNumbers = {
70+
$this.Numbers | Where-Object { -not ($_ % 2)}
71+
} .OddNumbers = {
72+
$this.Numbers | Where-Object { $_ % 2}
73+
}
74+
}
75+
~~~
76+
77+
## EqualityComparison Example 1
78+
79+
80+
~~~PowerShell
81+
Invoke-PipeScript -ScriptBlock {
82+
$a = 1
83+
if ($a == 1 ) {
84+
"A is $a"
85+
}
86+
}
87+
~~~
88+
89+
## EqualityComparison Example 2
90+
91+
92+
~~~PowerShell
93+
{
94+
$a == "b"
95+
} | .>PipeScript
6396
~~~
6497

6598
## PipedAssignment Example 1
@@ -108,7 +141,8 @@ This directory and it's subdirectories contain syntax changes that enable common
108141

109142
~~~PowerShell
110143
Invoke-PipeScript {
111-
'/[a|b]/'
144+
'/[a|b]/'.Matches('ab')
145+
}
112146
~~~
113147

114148
## RegexLiteral Example 3

0 commit comments

Comments
 (0)