From 8824edeebcf54005282dcf9f547884e68c031754 Mon Sep 17 00:00:00 2001 From: JJ Fullmer Date: Thu, 22 Aug 2024 07:54:28 -0600 Subject: [PATCH] Add foghost name tab completion #8 - formatting fix and added some docs Gh actions releases #18 - more progress towards auto release --- .github/workflows/tag-and-release.yml | 11 ++++++----- FogApi/Public/Get-FogHost.ps1 | 27 +++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index e106110..6f123e7 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -10,31 +10,32 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Call main workflow that calls all the distros + - name: Run the build test workflow run: gh workflow run build-test.yml env: GH_TOKEN: ${{ github.token }} confirm-build-test: + needs: run-build-test runs-on: windows-latest env: GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 - - name: Wait a minute for the runs to start + - name: Wait for the runs to start run: start-sleep 60 - name: Get run IDs run: | - $runid=((& gh run list --workflow built-test.yml --json databaseId --limit 1) | convertfrom-json)[0].databaseId + $runid=((& gh run list --workflow build-test.yml --json databaseId --limit 1) | convertfrom-json).databaseId echo "RUNID=$runid" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - name: confirm build didn't fail run: | $runstatus="" - while (($runstatus -ne "success") -AND ($run_status -ne "failure")) { + while (($runstatus -ne "success") -AND ($runstatus -ne "failure")) { start-sleep 15 - $runstatus=((& gh run view $env:RUN_ID --exit-status --json conclusion) | Convertfrom-json).conclusion + $runstatus=((& gh run view $env:RUNID --exit-status --json conclusion) | Convertfrom-json).conclusion } if ($runstatus -eq "failure") { exit 1 diff --git a/FogApi/Public/Get-FogHost.ps1 b/FogApi/Public/Get-FogHost.ps1 index 6f50eae..fce3a1e 100644 --- a/FogApi/Public/Get-FogHost.ps1 +++ b/FogApi/Public/Get-FogHost.ps1 @@ -13,7 +13,7 @@ function Get-FogHost { the uuid of the host .PARAMETER hostName - the hostname of the host + the hostname of the host, if your FOG version is 1.6 or above you can use tab complete for hostnames .PARAMETER macAddr a mac address linked to the host @@ -25,6 +25,7 @@ function Get-FogHost { Get-FogHost -hostName MeowMachine This would return the fog details of a host named MeowMachine in your fog instance + If using pwsh 7+ and your FOG service is 1.6 or above, you can tab complete to search for existing hosts by name .EXAMPLE Get-FogHost @@ -48,21 +49,19 @@ function Get-FogHost { [parameter(ParameterSetName='searchTerm')] [string]$uuid, [parameter(ParameterSetName='searchTerm')] - [ArgumentCompleter( - { - param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams) - if(test-fogverabove1dot6) { - $r = (Get-FogHosts).Name - - if ($WordToComplete) { - $r.Where{ $_ -match "^$WordToComplete" } - } - else { - $r - } + [ArgumentCompleter({ + param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams) + if(Test-FogVerAbove1dot6) { + $r = (Get-FogHosts).Name + + if ($WordToComplete) { + $r.Where{ $_ -match "^$WordToComplete" } + } + else { + $r } } - )] + })] [string]$hostName, [parameter(ParameterSetName='searchTerm')] [string]$macAddr,