@@ -17,15 +17,15 @@ namespace Microsoft.PowerShell.PSResourceGet.Cmdlets
17
17
/// The Install-PSResource cmdlet installs a resource.
18
18
/// It returns nothing.
19
19
/// </summary>
20
- [ Cmdlet ( VerbsLifecycle . Install ,
21
- "PSResource" ,
22
- DefaultParameterSetName = "NameParameterSet" ,
20
+ [ Cmdlet ( VerbsLifecycle . Install ,
21
+ "PSResource" ,
22
+ DefaultParameterSetName = "NameParameterSet" ,
23
23
SupportsShouldProcess = true ) ]
24
24
[ Alias ( "isres" ) ]
25
25
public sealed
26
26
class InstallPSResource : PSCmdlet
27
27
{
28
- #region Parameters
28
+ #region Parameters
29
29
30
30
/// <summary>
31
31
/// Specifies the exact names of resources to install from a repository.
@@ -42,7 +42,7 @@ class InstallPSResource : PSCmdlet
42
42
[ Parameter ( ParameterSetName = NameParameterSet , ValueFromPipelineByPropertyName = true ) ]
43
43
[ ValidateNotNullOrEmpty ]
44
44
public string Version { get ; set ; }
45
-
45
+
46
46
/// <summary>
47
47
/// Specifies to allow installation of prerelease versions
48
48
/// </summary>
@@ -53,6 +53,7 @@ class InstallPSResource : PSCmdlet
53
53
/// <summary>
54
54
/// Specifies the repositories from which to search for the resource to be installed.
55
55
/// </summary>
56
+ [ SupportsWildcards ]
56
57
[ Parameter ( ParameterSetName = NameParameterSet , ValueFromPipelineByPropertyName = true ) ]
57
58
[ Parameter ( ParameterSetName = InputObjectParameterSet , ValueFromPipelineByPropertyName = true ) ]
58
59
[ ArgumentCompleter ( typeof ( RepositoryNameCompleter ) ) ]
@@ -83,9 +84,9 @@ public string TemporaryPath
83
84
84
85
set
85
86
{
86
- if ( WildcardPattern . ContainsWildcardCharacters ( value ) )
87
- {
88
- throw new PSArgumentException ( "Wildcard characters are not allowed in the temporary path." ) ;
87
+ if ( WildcardPattern . ContainsWildcardCharacters ( value ) )
88
+ {
89
+ throw new PSArgumentException ( "Wildcard characters are not allowed in the temporary path." ) ;
89
90
}
90
91
91
92
// This will throw if path cannot be resolved
@@ -99,7 +100,7 @@ public string TemporaryPath
99
100
/// </summary>
100
101
[ Parameter ]
101
102
public SwitchParameter TrustRepository { get ; set ; }
102
-
103
+
103
104
/// <summary>
104
105
/// Overwrites a previously installed resource with the same name and version.
105
106
/// </summary>
@@ -130,7 +131,7 @@ public string TemporaryPath
130
131
/// </summary>
131
132
[ Parameter ]
132
133
public SwitchParameter SkipDependencyCheck { get ; set ; }
133
-
134
+
134
135
/// <summary>
135
136
/// Check validation for signed and catalog files
136
137
/// </summary>
@@ -287,7 +288,7 @@ protected override void ProcessRecord()
287
288
pkgCredential : Credential ,
288
289
reqResourceParams : null ) ;
289
290
break ;
290
-
291
+
291
292
case InputObjectParameterSet :
292
293
foreach ( var inputObj in InputObject ) {
293
294
string normalizedVersionString = Utils . GetNormalizedVersionString ( inputObj . Version . ToString ( ) , inputObj . Prerelease ) ;
@@ -362,7 +363,7 @@ protected override void ProcessRecord()
362
363
ErrorCategory . InvalidData ,
363
364
this ) ) ;
364
365
}
365
-
366
+
366
367
RequiredResourceHelper ( pkgsInFile ) ;
367
368
break ;
368
369
@@ -379,7 +380,7 @@ protected override void ProcessRecord()
379
380
}
380
381
}
381
382
*/
382
-
383
+
383
384
Hashtable pkgsHash = null ;
384
385
try
385
386
{
@@ -441,7 +442,7 @@ private void RequiredResourceHelper(Hashtable reqResourceHash)
441
442
{
442
443
var pkgNameEmptyOrWhitespaceError = new ErrorRecord (
443
444
new ArgumentException ( $ "The package name '{ pkgName } ' provided cannot be an empty string or whitespace.") ,
444
- "pkgNameEmptyOrWhitespaceError" ,
445
+ "pkgNameEmptyOrWhitespaceError" ,
445
446
ErrorCategory . InvalidArgument ,
446
447
this ) ;
447
448
@@ -454,7 +455,7 @@ private void RequiredResourceHelper(Hashtable reqResourceHash)
454
455
{
455
456
var requiredResourceHashtableInputFormatError = new ErrorRecord (
456
457
new ArgumentException ( $ "The RequiredResource input with name '{ pkgName } ' does not have a valid value, the value must be a hashtable.") ,
457
- "RequiredResourceHashtableInputFormatError" ,
458
+ "RequiredResourceHashtableInputFormatError" ,
458
459
ErrorCategory . InvalidArgument ,
459
460
this ) ;
460
461
@@ -483,7 +484,7 @@ private void RequiredResourceHelper(Hashtable reqResourceHash)
483
484
ThrowTerminatingError ( ParameterParsingError ) ;
484
485
}
485
486
}
486
-
487
+
487
488
if ( pkgParams . Scope == ScopeType . AllUsers )
488
489
{
489
490
_pathsToInstallPkg = Utils . GetAllInstallationPaths ( this , pkgParams . Scope ) ;
@@ -513,10 +514,10 @@ private void ProcessInstallHelper(string[] pkgNames, string pkgVersion, bool pkg
513
514
"NameContainsWildcard" ,
514
515
ErrorCategory . InvalidArgument ,
515
516
this ) ) ;
516
-
517
+
517
518
return ;
518
519
}
519
-
520
+
520
521
foreach ( string error in errorMsgs )
521
522
{
522
523
WriteError ( new ErrorRecord (
0 commit comments