Skip to content

Commit e0107d2

Browse files
author
James Brundage
committed
Template Transpilers: Enabling interactive use (Fixes #285)
1 parent 9e82498 commit e0107d2

40 files changed

+335
-119
lines changed

Transpilers/Templates/ADA.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,13 @@ begin {
7070
}
7171

7272
process {
73-
# Add parameters related to the file
74-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
75-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
73+
# If we have been passed a command
74+
if ($CommandInfo) {
75+
# add parameters related to the file.
76+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
77+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
78+
}
79+
7680
if ($Parameter) { $splat.Parameter = $Parameter }
7781
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
7882

Transpilers/Templates/ATOM.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ begin {
4545
}
4646

4747
process {
48-
# Add parameters related to the file
49-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
50-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
48+
# If we have been passed a command
49+
if ($CommandInfo) {
50+
# add parameters related to the file.
51+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
52+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
53+
}
54+
5155
if ($Parameter) { $splat.Parameter = $Parameter }
5256
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
5357

Transpilers/Templates/Bash.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ begin {
6666
}
6767

6868
process {
69-
# Add parameters related to the file
70-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
71-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
69+
# If we have been passed a command
70+
if ($CommandInfo) {
71+
# add parameters related to the file.
72+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
73+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
74+
}
75+
7276
if ($Parameter) { $splat.Parameter = $Parameter }
7377
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
7478

Transpilers/Templates/Basic.Template.psx.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ begin {
7878
}
7979

8080
process {
81-
# Add parameters related to the file
82-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
83-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
81+
# If we have been passed a command
82+
if ($CommandInfo) {
83+
# add parameters related to the file.
84+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
85+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
86+
}
8487
if ($Parameter) { $splat.Parameter = $Parameter }
8588
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
8689

Transpilers/Templates/Batch.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@ begin {
7575
}
7676

7777
process {
78-
# Add parameters related to the file
79-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
80-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
78+
# If we have been passed a command
79+
if ($CommandInfo) {
80+
# add parameters related to the file.
81+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
82+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
83+
}
84+
8185
if ($Parameter) { $splat.Parameter = $Parameter }
8286
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
8387

Transpilers/Templates/Bicep.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ begin {
5252
}
5353

5454
process {
55-
# Add parameters related to the file
56-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
57-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
55+
# If we have been passed a command
56+
if ($CommandInfo) {
57+
# add parameters related to the file.
58+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
59+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
60+
}
61+
5862
if ($Parameter) { $splat.Parameter = $Parameter }
5963
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
6064

Transpilers/Templates/CPlusPlus.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ begin {
5757
}
5858

5959
process {
60-
# Add parameters related to the file
61-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
62-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
60+
# If we have been passed a command
61+
if ($CommandInfo) {
62+
# add parameters related to the file.
63+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
64+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
65+
}
66+
6367
if ($Parameter) { $splat.Parameter = $Parameter }
6468
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
6569

Transpilers/Templates/CSS.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,13 @@ begin {
7676
}
7777

7878
process {
79-
# Add parameters related to the file
80-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
81-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
79+
# If we have been passed a command
80+
if ($CommandInfo) {
81+
# add parameters related to the file.
82+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
83+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
84+
}
85+
8286
if ($Parameter) { $splat.Parameter = $Parameter }
8387
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
8488

Transpilers/Templates/CSharp.Template.psx.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ begin {
9191
}
9292

9393
process {
94-
# Add parameters related to the file
95-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
96-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
94+
# If we have been passed a command
95+
if ($CommandInfo) {
96+
# add parameters related to the file.
97+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
98+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
99+
}
100+
97101
if ($Parameter) { $splat.Parameter = $Parameter }
98102
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
99103

Transpilers/Templates/Go.Template.psx.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ begin {
5757
}
5858

5959
process {
60-
# Add parameters related to the file
61-
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
62-
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
60+
# If we have been passed a command
61+
if ($CommandInfo) {
62+
# add parameters related to the file.
63+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
64+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
65+
}
6366
if ($Parameter) { $splat.Parameter = $Parameter }
6467
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
6568

0 commit comments

Comments
 (0)