Files
runner-images-sangeeth/images/linux/scripts/helpers/SoftwareReport.Helpers.psm1
Maxim Lobanov c00379c85c [Ubuntu] Update documentation generation to use shared software report module (#6823)
* Create ubuntu-report.yml

* Update ubuntu-report.yml

* Update ubuntu-report.yml

* Update Common.Helpers.psm1

* Update ubuntu-report.yml

* Update ubuntu-report.yml

* Update SoftwareReport.Generator.ps1

* Update ubuntu-report.yml

* Update ubuntu-report.yml

* env vars

* Implement language and runtime

* Add package management section

* fix typo

* fix typo

* add projectManagement and tools

* fix some tools

* add CLI tools, Java, PHP Tools, Haskell Tools, Rust Tools, Browsers, .NET Core

* fix typo

* more changes

* fix typo

* fix typo

* fix typo

* change templates

* fix toolset

* Update Ubuntu2004 and 2204 templates

* fix cargo

* fix tiny nitpicks

* Fix AddToolVersionsList

* Remove unused methods

* Fix contructor
2022-12-21 19:38:54 +01:00

42 lines
1019 B
PowerShell

function Take-OutputPart {
param (
[Parameter(ValueFromPipeline)]
[string] $toolOutput,
[string] $Delimiter = " ",
[int[]] $Part
)
$parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
$selectedParts = $parts[$Part]
return [string]::Join($Delimiter, $selectedParts)
}
function Restore-UserOwner {
sudo chown -R ${env:USER}: $env:HOME
}
function Get-LinkTarget {
param (
[string] $inputPath
)
$link = Get-Item $inputPath | Select-Object -ExpandProperty Target
if ($link) {
return " -> $link"
}
return ""
}
function Get-PathWithLink {
param (
[string] $inputPath
)
$link = Get-LinkTarget($inputPath)
return "${inputPath}${link}"
}
function Get-AptSourceRepository {
param([String] $PackageName)
$sourceUrl = Get-Content "$PSScriptRoot/../helpers/apt-sources.txt" | Select-String -Pattern $PackageName | Take-OutputPart -Part (1..3)
return $sourceUrl
}