diff --git a/help/Register-PSResourceRepository.md b/help/Register-PSResourceRepository.md index 9fb3e02e1..9b5cc7855 100644 --- a/help/Register-PSResourceRepository.md +++ b/help/Register-PSResourceRepository.md @@ -26,7 +26,7 @@ Register-PSResourceRepository [-PSGallery] [-Trusted] [-Priority ] [-Pass ### RepositoriesParameterSet ``` -Register-PSResourceRepository -Repositories [-PassThru] [-WhatIf] [-Confirm] [] +Register-PSResourceRepository -Repository [-PassThru] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -59,7 +59,7 @@ This example registers the "PSGallery" repository, with the 'PSGallery' paramete ### Example 3 ``` PS C:\> $arrayOfHashtables = @{Name = "psgettestlocal"; Uri = "c:/code/testdir"}, @{PSGallery = $True} -PS C:\> Register-PSResourceRepository -Repositories $arrayOfHashtables +PS C:\> Register-PSResourceRepository -Repository $arrayOfHashtables PS C:\> Get-PSResourceRepository Name Uri Trusted Priority ---- --- ------- -------- @@ -68,7 +68,7 @@ PS C:\> Get-PSResourceRepository ``` -This example registers multiple repositories at once. To do so, we use the `-Repositories` parameter and provide an array of hashtables. Each hashtable can only have keys associated with parameters for the NameParameterSet or the PSGalleryParameterSet. Upon running the command we can see that the "psgettestlocal" and "PSGallery" repositories have been succesfully registered. +This example registers multiple repositories at once. To do so, we use the `-Repository` parameter and provide an array of hashtables. Each hashtable can only have keys associated with parameters for the NameParameterSet or the PSGalleryParameterSet. Upon running the command we can see that the "psgettestlocal" and "PSGallery" repositories have been succesfully registered. ## PARAMETERS @@ -119,7 +119,7 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Repositories +### -Repository Specifies an array of hashtables which contains repository information and is used to register multiple repositories at once. ```yaml diff --git a/help/Set-PSResourceRepository.md b/help/Set-PSResourceRepository.md index f5dd6e52f..90eba5cb6 100644 --- a/help/Set-PSResourceRepository.md +++ b/help/Set-PSResourceRepository.md @@ -19,7 +19,7 @@ Set-PSResourceRepository [-Name] [-Uri ] [-Trusted] [-Priority ### RepositoriesParameterSet ``` -Set-PSResourceRepository -Repositories [-Priority ] [-WhatIf] [-Confirm] [] +Set-PSResourceRepository -Repository [-Priority ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -65,14 +65,14 @@ PS C:\> Get-PSResourceRepository -Name "*" PS C:\> $arrayOfHashtables = @{Name = "PSGallery"; Trusted = $True}, @{Name = "PoshTestGallery"; Uri = "c:/code/testdir"} -PS C:\> Set-PSResourceRepository -Repositories $arrayOfHashtables -PassThru +PS C:\> Set-PSResourceRepository -Repository $arrayOfHashtables -PassThru Name Uri Trusted Priority ---- --- ------- -------- PSGallery https://www.powershellgallery.com/api/v2 True 50 PoshTestGallery file:///c:/code/testdir False 50 ``` -This example first checks for all registered repositories. We wish to set the properties for multiple repositories at once (i.e the PSGallery and PoshTestGallery repositories), so we run Set-PSResourceRepository with the `-Repositories` parameter. This parameter takes an array of hashtables, where each hashtable contains information for a repository we wish to set information for. We also use the `-PassThru` parameter to see the changed repositories. +This example first checks for all registered repositories. We wish to set the properties for multiple repositories at once (i.e the PSGallery and PoshTestGallery repositories), so we run Set-PSResourceRepository with the `-Repository` parameter. This parameter takes an array of hashtables, where each hashtable contains information for a repository we wish to set information for. We also use the `-PassThru` parameter to see the changed repositories. ## PARAMETERS diff --git a/src/code/RegisterPSResourceRepository.cs b/src/code/RegisterPSResourceRepository.cs index 9ca9434d1..6564f4d18 100644 --- a/src/code/RegisterPSResourceRepository.cs +++ b/src/code/RegisterPSResourceRepository.cs @@ -64,7 +64,7 @@ class RegisterPSResourceRepository : PSCmdlet /// [Parameter(Mandatory = true, ParameterSetName = RepositoriesParameterSet)] [ValidateNotNullOrEmpty] - public Hashtable[] Repositories {get; set;} + public Hashtable[] Repository {get; set;} /// /// Specifies whether the repository should be trusted. @@ -270,7 +270,7 @@ private PSRepositoryInfo PSGalleryParameterSetHelper(int repoPriority, bool repo private List RepositoriesParameterSetHelper() { List reposAddedFromHashTable = new List(); - foreach (Hashtable repo in Repositories) + foreach (Hashtable repo in Repository) { if (repo.ContainsKey(PSGalleryRepoName)) { diff --git a/src/code/SetPSResourceRepository.cs b/src/code/SetPSResourceRepository.cs index 1adcd83ae..2ada5bdee 100644 --- a/src/code/SetPSResourceRepository.cs +++ b/src/code/SetPSResourceRepository.cs @@ -51,7 +51,7 @@ public sealed class SetPSResourceRepository : PSCmdlet /// [Parameter(Mandatory = true, ParameterSetName = RepositoriesParameterSet)] [ValidateNotNullOrEmpty] - public Hashtable[] Repositories { get; set; } + public Hashtable[] Repository { get; set; } /// /// Specifies whether the repository should be trusted. @@ -236,7 +236,7 @@ private PSRepositoryInfo UpdateRepositoryStoreHelper(string repoName, Uri repoUr private List RepositoriesParameterSetHelper() { List reposUpdatedFromHashtable = new List(); - foreach (Hashtable repo in Repositories) + foreach (Hashtable repo in Repository) { if (!repo.ContainsKey("Name") || repo["Name"] == null || String.IsNullOrEmpty(repo["Name"].ToString())) { diff --git a/test/RegisterPSResourceRepository.Tests.ps1 b/test/RegisterPSResourceRepository.Tests.ps1 index a15bfdf13..acaeca848 100644 --- a/test/RegisterPSResourceRepository.Tests.ps1 +++ b/test/RegisterPSResourceRepository.Tests.ps1 @@ -98,14 +98,14 @@ Describe "Test Register-PSResourceRepository" { $res.Priority | Should -Be 20 } - It "register repositories with Repositories parameter, all name parameter style repositories (RepositoriesParameterSet)" { + It "register repositories with -Repository parameter, all name parameter style repositories (RepositoriesParameterSet)" { $hashtable1 = @{Name = $TestRepoName1; Uri = $tmpDir1Path} $hashtable2 = @{Name = $TestRepoName2; Uri = $tmpDir2Path; Trusted = $True} $hashtable3 = @{Name = $TestRepoName3; Uri = $tmpDir3Path; Trusted = $True; Priority = 20} $hashtable4 = @{Name = $TestRepoName4; Uri = $tmpDir4Path; Trusted = $True; Priority = 30; CredentialInfo = (New-Object Microsoft.PowerShell.PowerShellGet.UtilClasses.PSCredentialInfo ("testvault", "testsecret"))} $arrayOfHashtables = $hashtable1, $hashtable2, $hashtable3, $hashtable4 - Register-PSResourceRepository -Repositories $arrayOfHashtables + Register-PSResourceRepository -Repository $arrayOfHashtables $res = Get-PSResourceRepository -Name $TestRepoName1 $Res.Uri.LocalPath | Should -Contain $tmpDir1Path $res.Trusted | Should -Be False @@ -130,17 +130,17 @@ Describe "Test Register-PSResourceRepository" { $res4.CredentialInfo.Credential | Should -BeNullOrEmpty } - It "register repositories with Repositories parameter, psgallery style repository (RepositoriesParameterSet)" { + It "register repositories with -Repository parameter, psgallery style repository (RepositoriesParameterSet)" { Unregister-PSResourceRepository -Name $PSGalleryName $hashtable1 = @{PSGallery = $True} - Register-PSResourceRepository -Repositories $hashtable1 + Register-PSResourceRepository -Repository $hashtable1 $res = Get-PSResourceRepository -Name $PSGalleryName $res.Uri | Should -Be $PSGalleryUri $res.Trusted | Should -Be False $res.Priority | Should -Be 50 } - It "register repositories with Repositories parameter, name and psgallery parameter styles (RepositoriesParameterSet)" { + It "register repositories with -Repository parameter, name and psgallery parameter styles (RepositoriesParameterSet)" { Unregister-PSResourceRepository -Name $PSGalleryName $hashtable1 = @{PSGallery = $True} $hashtable2 = @{Name = $TestRepoName1; Uri = $tmpDir1Path} @@ -149,7 +149,7 @@ Describe "Test Register-PSResourceRepository" { $hashtable5 = @{Name = $TestRepoName4; Uri = $tmpDir4Path; Trusted = $True; Priority = 30; CredentialInfo = (New-Object Microsoft.PowerShell.PowerShellGet.UtilClasses.PSCredentialInfo ("testvault", "testsecret"))} $arrayOfHashtables = $hashtable1, $hashtable2, $hashtable3, $hashtable4, $hashtable5 - Register-PSResourceRepository -Repositories $arrayOfHashtables + Register-PSResourceRepository -Repository $arrayOfHashtables $res1 = Get-PSResourceRepository -Name $PSGalleryName $res1.Uri | Should -Be $PSGalleryUri @@ -220,7 +220,7 @@ Describe "Test Register-PSResourceRepository" { $arrayOfHashtables = $correctHashtable1, $correctHashtable2, $IncorrectHashTable, $correctHashtable3 Unregister-PSResourceRepository -Name $PSGalleryName - Register-PSResourceRepository -Repositories $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue + Register-PSResourceRepository -Repository $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue $err.Count | Should -Not -Be 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "NotProvideNameUriCredentialInfoForPSGalleryRepositoriesParameterSetRegistration,Microsoft.PowerShell.PowerShellGet.Cmdlets.RegisterPSResourceRepository" @@ -248,7 +248,7 @@ Describe "Test Register-PSResourceRepository" { $arrayOfHashtables = $correctHashtable1, $correctHashtable2, $IncorrectHashTable, $correctHashtable3 Unregister-PSResourceRepository -Name $PSGalleryName - Register-PSResourceRepository -Repositories $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue + Register-PSResourceRepository -Repository $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue $err.Count | Should -Not -Be 0 $err[0].FullyQualifiedErrorId | Should -BeExactly $ErrorId diff --git a/test/SetPSResourceRepository.Tests.ps1 b/test/SetPSResourceRepository.Tests.ps1 index f3d35f351..25eb1c820 100644 --- a/test/SetPSResourceRepository.Tests.ps1 +++ b/test/SetPSResourceRepository.Tests.ps1 @@ -112,7 +112,7 @@ Describe "Test Set-PSResourceRepository" { $incorrectHashTable = @{Name = $Name; Trusted = $True} $arrayOfHashtables = $hashtable1, $incorrectHashTable, $hashtable2 - Set-PSResourceRepository -Repositories $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue + Set-PSResourceRepository -Repository $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue $err.Count | Should -Not -Be 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "$ErrorId,Microsoft.PowerShell.PowerShellGet.Cmdlets.SetPSResourceRepository" @@ -138,7 +138,7 @@ Describe "Test Set-PSResourceRepository" { $hashtable4 = @{Name = $PSGalleryName; Trusted = $True}; $arrayOfHashtables = $hashtable1, $hashtable2, $hashtable3, $hashtable4 - Set-PSResourceRepository -Repositories $arrayOfHashtables + Set-PSResourceRepository -Repository $arrayOfHashtables $res = Get-PSResourceRepository -Name $TestRepoName1 $res.Name | Should -Be $TestRepoName1 $Res.Uri.LocalPath | Should -Contain $tmpDir2Path @@ -192,7 +192,7 @@ Describe "Test Set-PSResourceRepository" { $hashtable2 = @{Name = $TestRepoName1; Priority = 25} $arrayOfHashtables = $hashtable1, $hashtable2 - Set-PSResourceRepository -Repositories $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue + Set-PSResourceRepository -Repository $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue $err.Count | Should -Not -Be 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "ErrorSettingIndividualRepoFromRepositories,Microsoft.PowerShell.PowerShellGet.Cmdlets.SetPSResourceRepository" @@ -222,7 +222,7 @@ Describe "Test Set-PSResourceRepository" { $hashtable2 = @{Name = $TestRepoName1; Priority = 25} $arrayOfHashtables = $hashtable1, $hashtable2 - Set-PSResourceRepository -Repositories $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue + Set-PSResourceRepository -Repository $arrayOfHashtables -ErrorVariable err -ErrorAction SilentlyContinue $err.Count | Should -Not -Be 0 $err[0].FullyQualifiedErrorId | Should -BeExactly "ErrorSettingIndividualRepoFromRepositories,Microsoft.PowerShell.PowerShellGet.Cmdlets.SetPSResourceRepository"