diff --git a/help/Register-PSResourceRepository.md b/help/Register-PSResourceRepository.md index a0b52ae53..308be06ec 100644 --- a/help/Register-PSResourceRepository.md +++ b/help/Register-PSResourceRepository.md @@ -178,8 +178,8 @@ Accept wildcard characters: False ### -Priority -Specifies the priority ranking of the repository. Valid priority values range from 0 to 50. Lower -values have a higher priority ranking. The default value is `50`. +Specifies the priority ranking of the repository. Valid priority values range from 0 to 100. Lower +values have a higher priority ranking. The default value is `100`. Repositories are searched in priority order (highest first). diff --git a/help/en-US/PowerShellGet.dll-Help.xml b/help/en-US/PowerShellGet.dll-Help.xml index f251ef402..0afb8205c 100644 --- a/help/en-US/PowerShellGet.dll-Help.xml +++ b/help/en-US/PowerShellGet.dll-Help.xml @@ -1933,7 +1933,7 @@ Priority - Specifies the priority ranking of the repository. Repositories with higher ranking priority are searched before a lower ranking priority one, when searching for a repository item across multiple registered repositories. Valid priority values range from 0 to 50, such that a lower numeric value (i.e 10) corresponds to a higher priority ranking than a higher numeric value (i.e 40). Has default value of 50. + Specifies the priority ranking of the repository. Repositories with higher ranking priority are searched before a lower ranking priority one, when searching for a repository item across multiple registered repositories. Valid priority values range from 0 to 100, such that a lower numeric value (i.e 10) corresponds to a higher priority ranking than a higher numeric value (i.e 40). Has default value of 50. Int32 @@ -2788,7 +2788,7 @@ PS C:\> Get-PSResourceRepository Priority - Specifies the priority ranking of the repository, such that repositories with higher ranking priority are searched before a lower ranking priority one, when searching for a repository item across multiple registered repositories. Valid priority values range from 0 to 50, such that a lower numeric value (i.e 10) corresponds to a higher priority ranking than a higher numeric value (i.e 40). + Specifies the priority ranking of the repository, such that repositories with higher ranking priority are searched before a lower ranking priority one, when searching for a repository item across multiple registered repositories. Valid priority values range from 0 to 100, such that a lower numeric value (i.e 10) corresponds to a higher priority ranking than a higher numeric value (i.e 40). System.Int32 @@ -2884,7 +2884,7 @@ PS C:\> Get-PSResourceRepository Priority - Specifies the priority ranking of the repository, such that repositories with higher ranking priority are searched before a lower ranking priority one, when searching for a repository item across multiple registered repositories. Valid priority values range from 0 to 50, such that a lower numeric value (i.e 10) corresponds to a higher priority ranking than a higher numeric value (i.e 40). + Specifies the priority ranking of the repository, such that repositories with higher ranking priority are searched before a lower ranking priority one, when searching for a repository item across multiple registered repositories. Valid priority values range from 0 to 100, such that a lower numeric value (i.e 10) corresponds to a higher priority ranking than a higher numeric value (i.e 40). System.Int32 @@ -3026,7 +3026,7 @@ PS C:\> Set-PSResourceRepository -Name "PSGallery" -Priority 25 -Trusted -Pas ---- --- ------- -------- PSGallery https://www.powershellgallery.com/api/v2 True 25 - This example first checks if the PSGallery repository has been registered. We wish to set the `-Priority` and `-Trusted` values of this repository by running the Set-PSResourceRepository cmdlet with the `-Priority` parameter set to a value between 0 and 50 and by using the `-Trusted` parameter switch. We run the Get-PSResourceRepository cmdlet again to ensure that the `-Priority` and `-Trusted` values of the repository were changed. An important note here is that just for the default PSGallery repository, the `-Uri` value can't be changed/set. We also use the `-PassThru` parameter to see the changed repository. + This example first checks if the PSGallery repository has been registered. We wish to set the `-Priority` and `-Trusted` values of this repository by running the Set-PSResourceRepository cmdlet with the `-Priority` parameter set to a value between 0 and 100 and by using the `-Trusted` parameter switch. We run the Get-PSResourceRepository cmdlet again to ensure that the `-Priority` and `-Trusted` values of the repository were changed. An important note here is that just for the default PSGallery repository, the `-Uri` value can't be changed/set. We also use the `-PassThru` parameter to see the changed repository. diff --git a/src/code/PSRepositoryInfo.cs b/src/code/PSRepositoryInfo.cs index d5fbebb25..39b42aadd 100644 --- a/src/code/PSRepositoryInfo.cs +++ b/src/code/PSRepositoryInfo.cs @@ -44,7 +44,7 @@ public PSRepositoryInfo(string name, Uri uri, int priority, bool trusted, PSCred /// /// the priority of the repository /// - [ValidateRange(0, 50)] + [ValidateRange(0, 100)] public int Priority { get; } /// diff --git a/src/code/RegisterPSResourceRepository.cs b/src/code/RegisterPSResourceRepository.cs index d6857837a..8f0c16a2a 100644 --- a/src/code/RegisterPSResourceRepository.cs +++ b/src/code/RegisterPSResourceRepository.cs @@ -29,8 +29,8 @@ class RegisterPSResourceRepository : PSCmdlet private readonly string PSGalleryRepoName = "PSGallery"; private readonly string PSGalleryRepoUri = "https://www.powershellgallery.com/api/v2"; - private const int defaultPriority = 50; - private const bool defaultTrusted = false; + private const int DefaultPriority = 50; + private const bool DefaultTrusted = false; private const string NameParameterSet = "NameParameterSet"; private const string PSGalleryParameterSet = "PSGalleryParameterSet"; private const string RepositoriesParameterSet = "RepositoriesParameterSet"; @@ -77,13 +77,13 @@ class RegisterPSResourceRepository : PSCmdlet /// /// Specifies the priority ranking of the repository, such that repositories with higher ranking priority are searched /// before a lower ranking priority one, when searching for a repository item across multiple registered repositories. - /// Valid priority values range from 0 to 50, such that a lower numeric value (i.e 10) corresponds + /// Valid priority values range from 0 to 100, such that a lower numeric value (i.e 10) corresponds /// to a higher priority ranking than a higher numeric value (i.e 40). Has default value of 50. /// [Parameter(ParameterSetName = NameParameterSet)] [Parameter(ParameterSetName = PSGalleryParameterSet)] - [ValidateRange(0, 50)] - public int Priority { get; set; } = defaultPriority; + [ValidateRange(0, 100)] + public int Priority { get; set; } = DefaultPriority; /// /// Specifies vault and secret names as PSCredentialInfo for the repository. @@ -289,8 +289,8 @@ private List RepositoriesParameterSetHelper() { WriteVerbose("(RepositoriesParameterSet): on repo: PSGallery. Registers PSGallery repository"); reposAddedFromHashTable.Add(PSGalleryParameterSetHelper( - repo.ContainsKey("Priority") ? (int)repo["Priority"] : defaultPriority, - repo.ContainsKey("Trusted") ? (bool)repo["Trusted"] : defaultTrusted)); + repo.ContainsKey("Priority") ? (int)repo["Priority"] : DefaultPriority, + repo.ContainsKey("Trusted") ? (bool)repo["Trusted"] : DefaultTrusted)); } catch (Exception e) { @@ -371,8 +371,8 @@ private PSRepositoryInfo RepoValidationHelper(Hashtable repo) WriteVerbose(String.Format("(RepositoriesParameterSet): on repo: {0}. Registers Name based repository", repo["Name"])); return NameParameterSetHelper(repo["Name"].ToString(), repoUri, - repo.ContainsKey("Priority") ? Convert.ToInt32(repo["Priority"].ToString()) : defaultPriority, - repo.ContainsKey("Trusted") ? Convert.ToBoolean(repo["Trusted"].ToString()) : defaultTrusted, + repo.ContainsKey("Priority") ? Convert.ToInt32(repo["Priority"].ToString()) : DefaultPriority, + repo.ContainsKey("Trusted") ? Convert.ToBoolean(repo["Trusted"].ToString()) : DefaultTrusted, repoCredentialInfo); } catch (Exception e) diff --git a/src/code/RepositorySettings.cs b/src/code/RepositorySettings.cs index dec5d2d15..76e68a27e 100644 --- a/src/code/RepositorySettings.cs +++ b/src/code/RepositorySettings.cs @@ -24,8 +24,8 @@ internal static class RepositorySettings // The repository store file's location is currently only at '%LOCALAPPDATA%\PowerShellGet' for the user account. private const string PSGalleryRepoName = "PSGallery"; private const string PSGalleryRepoUri = "https://www.powershellgallery.com/api/v2"; - private const int defaultPriority = 50; - private const bool defaultTrusted = false; + private const int DefaultPriority = 50; + private const bool DefaultTrusted = false; private const string RepositoryFileName = "PSResourceRepository.xml"; private static readonly string RepositoryPath = Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData), "PowerShellGet"); @@ -60,7 +60,7 @@ public static void CheckRepositoryStore() // Add PSGallery to the newly created store Uri psGalleryUri = new Uri(PSGalleryRepoUri); - Add(PSGalleryRepoName, psGalleryUri, defaultPriority, defaultTrusted, repoCredentialInfo: null); + Add(PSGalleryRepoName, psGalleryUri, DefaultPriority, DefaultTrusted, repoCredentialInfo: null); } // Open file (which should exist now), if cannot/is corrupted then throw error diff --git a/src/code/SetPSResourceRepository.cs b/src/code/SetPSResourceRepository.cs index c1a71a05e..8963b76b7 100644 --- a/src/code/SetPSResourceRepository.cs +++ b/src/code/SetPSResourceRepository.cs @@ -74,12 +74,12 @@ public SwitchParameter Trusted /// /// Specifies the priority ranking of the repository, such that repositories with higher ranking priority are searched /// before a lower ranking priority one, when searching for a repository item across multiple registered repositories. - /// Valid priority values range from 0 to 50, such that a lower numeric value (i.e 10) corresponds + /// Valid priority values range from 0 to 100, such that a lower numeric value (i.e 10) corresponds /// to a higher priority ranking than a higher numeric value (i.e 40). /// [Parameter(ParameterSetName = NameParameterSet)] [ValidateNotNullOrEmpty] - [ValidateRange(0, 50)] + [ValidateRange(0, 100)] public int Priority { get; set; } = DefaultPriority; ///