From e9b9c1e2e8e24b16a5b306d33959de20401e7171 Mon Sep 17 00:00:00 2001 From: Erich Gamma Date: Wed, 16 Jan 2019 11:16:14 +0100 Subject: [PATCH] Added a dev container for PS --- .../.vscode/devContainer.json | 6 ++++ .../dev-container.dockerfile | 6 ++++ dev-containers/powershell-container/test.ps1 | 28 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 dev-containers/powershell-container/.vscode/devContainer.json create mode 100644 dev-containers/powershell-container/dev-container.dockerfile create mode 100644 dev-containers/powershell-container/test.ps1 diff --git a/dev-containers/powershell-container/.vscode/devContainer.json b/dev-containers/powershell-container/.vscode/devContainer.json new file mode 100644 index 0000000000..0cc44eb510 --- /dev/null +++ b/dev-containers/powershell-container/.vscode/devContainer.json @@ -0,0 +1,6 @@ +{ + "dockerFile": "dev-container.dockerfile", + "extensions": [ + "ms-vscode.powershell" + ] +} \ No newline at end of file diff --git a/dev-containers/powershell-container/dev-container.dockerfile b/dev-containers/powershell-container/dev-container.dockerfile new file mode 100644 index 0000000000..d38c79e015 --- /dev/null +++ b/dev-containers/powershell-container/dev-container.dockerfile @@ -0,0 +1,6 @@ +FROM microsoft/powershell + +# Install required tools +RUN apt-get update \ + && apt-get install -y git \ + && rm -rf /var/lib/apt/lists/* diff --git a/dev-containers/powershell-container/test.ps1 b/dev-containers/powershell-container/test.ps1 new file mode 100644 index 0000000000..478990bfd2 --- /dev/null +++ b/dev-containers/powershell-container/test.ps1 @@ -0,0 +1,28 @@ +param([int]$Count=50, [int]$DelayMilliseconds=200) + +function Write-Item($itemCount) { + $i = 1 + + while ($i -le $itemCount) { + $str = "Output $i" + Write-Output $str + + # In the gutter on the left, right click and select "Add Conditional Breakpoint" + # on the next line. Use the condition: $i -eq 25 + $i = $i + 1 + + # Slow down execution a bit so user can test the "Pause debugger" feature. + Start-Sleep -Milliseconds $DelayMilliseconds + } +} + +# Do-Work will be underlined in green if you haven't disable script analysis. +# Hover over the function name below to see the PSScriptAnalyzer warning that "Do-Work" +# doesn't use an approved verb. +function Do-Work($workCount) { + Write-Output "Doing work..." + Write-Item $workcount + Write-Host "Done!" +} + +Do-Work $Count