Skip to content

Commit 5243a01

Browse files
Merge pull request #267 from StartAutomating/MorePipeScript
More pipe script
2 parents 5c67b30 + 6297c98 commit 5243a01

32 files changed

+1163
-406
lines changed

.github/workflows/OnIssue.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ jobs:
1919
PublishParameters: |
2020
{
2121
"Get-GitPubIssue": {
22-
"UserName": '${{github.repository_owner}}',
23-
"Repository": "PipeScript"
22+
"Repository": '${{github.repository}}'
2423
},
2524
"Get-GitPubRelease": {
26-
"UserName": '${{github.repository_owner}}',
27-
"Repository": "PipeScript"
25+
"Repository": '${{github.repository}}'
2826
},
2927
"Publish-GitPubJekyll": {
3028
"OutputPath": "docs/_posts"

.github/workflows/TestAndPublish.yml

Lines changed: 79 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ jobs:
306306
$Parameters.UserName = ${env:UserName}
307307
$Parameters.TagVersionFormat = ${env:TagVersionFormat}
308308
$Parameters.ReleaseNameFormat = ${env:ReleaseNameFormat}
309+
$Parameters.ReleaseAsset = ${env:ReleaseAsset}
310+
$Parameters.ReleaseAsset = $parameters.ReleaseAsset -split ';' -replace '^[''"]' -replace '[''"]$'
309311
foreach ($k in @($parameters.Keys)) {
310312
if ([String]::IsNullOrEmpty($parameters[$k])) {
311313
$parameters.Remove($k)
@@ -331,7 +333,11 @@ jobs:
331333
332334
# The release name format (default value: '$($imported.Name) $($imported.Version)')
333335
[string]
334-
$ReleaseNameFormat = '$($imported.Name) $($imported.Version)'
336+
$ReleaseNameFormat = '$($imported.Name) $($imported.Version)',
337+
338+
# Any assets to attach to the release. Can be a wildcard or file name.
339+
[string[]]
340+
$ReleaseAsset
335341
)
336342
337343
@@ -377,32 +383,80 @@ jobs:
377383
378384
if ($releaseExists) {
379385
"::warning::Release '$($releaseExists.Name )' Already Exists" | Out-Host
380-
return
386+
$releasedIt = $releaseExists
387+
} else {
388+
$releasedIt = Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
389+
[Ordered]@{
390+
owner = '${{github.owner}}'
391+
repo = '${{github.repository}}'
392+
tag_name = $targetVersion
393+
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
394+
body =
395+
if ($env:RELEASENOTES) {
396+
$env:RELEASENOTES
397+
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
398+
$imported.PrivateData.PSData.ReleaseNotes
399+
} else {
400+
"$($imported.Name) $targetVersion"
401+
}
402+
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
403+
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
404+
} | ConvertTo-Json
405+
) -Headers @{
406+
"Accept" = "application/vnd.github.v3+json"
407+
"Content-type" = "application/json"
408+
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
409+
}
410+
}
411+
412+
413+
414+
415+
416+
if (-not $releasedIt) {
417+
throw "Release failed"
418+
} else {
419+
$releasedIt | Out-Host
381420
}
382421
422+
$releaseUploadUrl = $releasedIt.upload_url -replace '\{.+$'
383423
384-
Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
385-
[Ordered]@{
386-
owner = '${{github.owner}}'
387-
repo = '${{github.repository}}'
388-
tag_name = $targetVersion
389-
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
390-
body =
391-
if ($env:RELEASENOTES) {
392-
$env:RELEASENOTES
393-
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
394-
$imported.PrivateData.PSData.ReleaseNotes
395-
} else {
396-
"$($imported.Name) $targetVersion"
424+
if ($ReleaseAsset) {
425+
$fileList = Get-ChildItem -Recurse
426+
$filesToRelease =
427+
@(:nextFile foreach ($file in $fileList) {
428+
foreach ($relAsset in $ReleaseAsset) {
429+
if ($relAsset -match '[\*\?]') {
430+
if ($file.Name -like $relAsset) {
431+
$file; continue nextFile
432+
}
433+
} elseif ($file.Name -eq $relAsset -or $file.FullName -eq $relAsset) {
434+
$file; continue nextFile
435+
}
397436
}
398-
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
399-
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
400-
} | ConvertTo-Json
401-
) -Headers @{
402-
"Accept" = "application/vnd.github.v3+json"
403-
"Content-type" = "application/json"
404-
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
437+
})
438+
439+
$releasedFiles = @{}
440+
foreach ($file in $filesToRelease) {
441+
if ($releasedFiles[$file.Name]) {
442+
Write-Warning "Already attached file $($file.Name)"
443+
continue
444+
} else {
445+
$fileBytes = [IO.File]::ReadAllBytes($file.FullName)
446+
$releasedFiles[$file.Name] =
447+
Invoke-RestMethod -Uri "${releaseUploadUrl}?name=$($file.Name)" -Headers @{
448+
"Accept" = "application/vnd.github+json"
449+
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
450+
} -Body $fileBytes -ContentType Application/octet-stream
451+
$releasedFiles[$file.Name]
452+
}
453+
}
454+
455+
"Attached $($releasedFiles.Count) file(s) to release" | Out-Host
405456
}
457+
458+
459+
406460
} @Parameters
407461
- name: PublishPowerShellGallery
408462
id: PublishPowerShellGallery
@@ -516,18 +570,18 @@ jobs:
516570
}
517571
}
518572
} @Parameters
519-
BuildModule:
573+
BuildPipescript:
520574
runs-on: ubuntu-latest
521575
if: ${{ success() }}
522576
steps:
523577
- name: Check out repository
524578
uses: actions/checkout@v2
579+
- name: UsePiecemeal
580+
uses: StartAutomating/Piecemeal@main
525581
- name: BuildPipeScript
526582
uses: StartAutomating/PipeScript@main
527583
- name: UseEZOut
528584
uses: StartAutomating/EZOut@master
529-
- name: UsePiecemeal
530-
uses: StartAutomating/Piecemeal@main
531585
- name: UseHelpOut
532586
uses: StartAutomating/HelpOut@master
533587
env:

CHANGELOG.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1+
## 0.1.8:
2+
* Improvements to 'all' keyword (#264 #263 #260 #253)
3+
* Keywords can now be run interactively (#263)
4+
* New keyword can be piped to (#265)
5+
* Sentences can now map multi-word aliases (#260)
6+
* New [CommandAST] properties: .IsPipedTo .IsPipedFrom
7+
* Added Inline HAXE and Inline Racket support (#259 #262)
8+
9+
---
10+
11+
112
## 0.1.7:
213
* Added LATEX / TEX support (Fixes #230)
314
* Adding LUA support (Fixes #246)
415
* Fixing Core Transpiler Attribute Behavior (Fixes #247)
16+
517
---
618

719
## 0.1.6:
@@ -10,12 +22,14 @@
1022
* New Language Support:
1123
* HashiCorp Language (HCL) (Fixes #240 / #241)
1224
* WebAssembly (WAT) (Fixes #239)
25+
1326
---
1427

1528
## 0.1.5:
1629
* Support for [inherit]ing a command (Fixes #235) (finally/wow)
1730
* Join-PipeScript: Overhauling (Fixes #231 Fixes #232 Fixes #233 Fixes #236)
1831
* [Management.Automation.Language] type extensions: Adding .Script property and .ToString() scriptmethod (Fixes #234)
32+
1933
---
2034

2135
## 0.1.4:
@@ -27,6 +41,7 @@
2741
* Improved documentation of [decorate] transpiler (Fixes #222)
2842
* Core Parameter Transpiler no longer considers real types (Fixes #223)
2943
* Adding new value for PipeScript.PipeScriptType: BuildScript (Fixes #228)
44+
3045
---
3146

3247
## 0.1.3:
@@ -51,6 +66,7 @@
5166
* ParameterTypeConstraint now ignores [ordered] (Fixes #190)
5267
* Extended Type System Improvements:
5368
* [ScriptBlock].Transpile() now throws (Fixes #212)
69+
5470
---
5571

5672
## 0.1.2:
@@ -71,6 +87,7 @@
7187
* Adding Hashtable formatter (Fixes #187)
7288
* HTTP Protocol: Enabling Splatting (Fixes #183)
7389
* Requiring Inline Transpilers accept [Management.Automation.CommandInfo] from the Pipeline (Fixes #184)
90+
7491
---
7592

7693
## 0.1.1:
@@ -90,6 +107,7 @@
90107
* CommandAST: Fixing .GetParameter (Fixes #175)
91108
* Updating PSToken control (more colorization) (Fixes #166)
92109
* YAML Formatter indent / primitive support (Fixes #180)
110+
93111
---
94112

95113
## 0.1:
@@ -113,6 +131,7 @@
113131
* Not running when there is not a current branch (#158)
114132
* Improving email determination (#156)
115133
* Invoke-PipeScript terminates transpiler errors when run interactively (#161)
134+
116135
---
117136

118137
## 0.0.13:
@@ -126,9 +145,8 @@
126145
* Now Supporting Inline PipeScript in YAML (#147)
127146
* General Improvements:
128147
* Extending AST Types (#145)
129-
* Adding tests for keywords
130-
---
131148

149+
---
132150

133151
## 0.0.12:
134152
* Adding assert keyword (#143)
@@ -137,11 +155,13 @@
137155
* Handling multiple QueryString values (#139)
138156
* Only passing ContentType to invoker if invoker supports it (#141)
139157
* Defaulting to JSON body when ContentType is unspecified (#140)
158+
140159
---
141160

142161
## 0.0.11:
143162
* Source Generators Now Support Parameters / Arguments (#75)
144163
* Invoke-PipeScript Terminating Build Errors (#135)
164+
145165
---
146166

147167
## 0.0.10:
@@ -156,6 +176,7 @@
156176
* Join-PipeScript (#124)
157177
* Adding .Examples
158178
* Fixing parameter joining issues
179+
159180
---
160181

161182
## 0.0.9:
@@ -166,6 +187,7 @@
166187
* REST Transpiler automatically coerces [DateTime] and [switch] parameters (#118)
167188
* Join-PipeScript: Fixing multiparam error (#124)
168189
* ValidateScriptBlock: Only validing ScriptBlocks (#125)
190+
169191
---
170192

171193
## 0.0.8:
@@ -182,6 +204,7 @@
182204
* Shared Context within Inline Transpilers (#112)
183205
* Fixing Include Transpiler Pattern (#96)
184206
* Join-PipeScript interactive .Substring error (#116)
207+
185208
---
186209

187210
## 0.0.7:
@@ -196,6 +219,7 @@
196219
* Explicit Transpiler returns modified ScriptBlock (#102)
197220
* .psm1 alias export fix (#100)
198221
* Include improvements (#96)
222+
199223
---
200224

201225
## 0.0.6:
@@ -206,6 +230,7 @@
206230
* PipeScript.psm1 is now build with PipeScript (#95)
207231
* Join-PipeScript: Fixing -BlockType (#97)
208232
* GitHub Action will now look for PipeScript.psd1 in the workspace first (#98)
233+
209234
---
210235

211236
## 0.0.5
@@ -219,20 +244,22 @@
219244
* Inline PipeScript Support for New Languages
220245
* .>Inline.PSD1 (#89)
221246
* .>Inline.XML now handles .PS1XML (#91)
247+
222248
---
223249

224250
## 0.0.4
225251
* New Transpilers:
226252
* .>RegexLiteral (#77)
227253
* Improved Transpilers:
228254
* .>PipeScript.Inline now supports -ReplacePattern (#84)
229-
* .>Include now supports wildcards (#81)
255+
* .>Include now supports wildcards (#81)
230256
* Inline PipeScript Support for New Languages
231257
* ATOM (#79)
232258
* Bicep (#73)
233259
* HLSL (#76)
234260
* Perl / POD (#74)
235261
* RSS (#80)
262+
236263
---
237264

238265
## 0.0.3
@@ -248,6 +275,7 @@
248275
* .>ValidateTypes transpiler now returns true (#65)
249276
* .>ValidateTypes transpiler now can apply to a [VariableExpressionAST] (#66)
250277
* Building PipeScript with PipeScript (#54)
278+
251279
---
252280

253281
## 0.0.2
@@ -258,6 +286,8 @@
258286
* Transpiler Fixes
259287
* .>VBN now supports -Position (#57)
260288
* GitHub Action Bugfix (#55)
289+
261290
---
291+
262292
## 0.0.1
263-
Initial Commit.
293+
Initial Commit.
Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
Write-FormatView -TypeName PipeScript.Sentence -Action {
22

3-
Write-FormatViewExpression -ForegroundColor Verbose -Property Keyword -If { $_.Command }
4-
Write-FormatViewExpression -ForegroundColor Success -ScriptBlock { " <# $($_.Command) #> " } -If { $_.Command }
3+
Write-FormatViewExpression -ForegroundColor Warning -Property Keyword -If { $_.Command }
4+
Write-FormatViewExpression -ForegroundColor green -ScriptBlock { " <# $($_.Command) #> " } -If { $_.Command }
55

66
Write-FormatViewExpression -ScriptBlock { ' ' }
77
Write-FormatViewExpression -ScriptBlock {
88
@(foreach ($clause in $_.Clauses) {
99
$wordNumber = -1
10-
foreach ($word in $clause.Words) {
10+
$wordSkipCount = 0
11+
if ($clause.Name) {
12+
$wordSkipCount = @($clause.Name -split '\s').Count
13+
Format-RichText -InputObject " $($clause.Name)" -ForegroundColor Cyan -Italic
14+
}
15+
16+
if ($clause.ParameterName) {
17+
Format-RichText -InputObject " <# -$($clause.ParameterName) #>" -ForegroundColor green
18+
}
19+
20+
foreach ($word in $clause.Words | Select-Object -Skip $wordSkipCount) {
1121
$wordNumber++
12-
if (-not $wordNumber) {
13-
Format-RichText -ForegroundColor Warning -InputObject "$word"
14-
} else {
15-
Format-RichText -InputObject "$word"
16-
}
22+
if ("$word" -match '^[\$\@]') {
23+
Format-RichText -InputObject "$word" -ForegroundColor Success
24+
} elseif ($wordSkipCount) {
25+
Format-RichText -InputObject "$word"
26+
} else {
27+
Format-RichText -InputObject "$word" -ForegroundColor Magenta
28+
}
1729
}
1830
}) -join ' '
1931
}
20-
32+
2133
Write-FormatViewExpression -ForegroundColor Magenta -If { $_.Arguments -and -not $_.Clauses } -ScriptBlock {
2234
$_.Arguments -join ' '
23-
}
35+
}
2436
}

0 commit comments

Comments
 (0)