@@ -326,31 +326,35 @@ private List<PSResourceInfo> InstallPackage(
326326
327327 _cmdletPassedIn . WriteVerbose ( string . Format ( "Begin installing package: '{0}'" , pkg . Name ) ) ;
328328
329- int activityId = 0 ;
330- string activity = "" ;
331- string statusDescription = "" ;
332-
333- if ( pkgNamesToInstall . ToList ( ) . Contains ( pkg . Name , StringComparer . InvariantCultureIgnoreCase ) )
334- {
335- // Installing parent package (one whose name was passed in to install)
336- activityId = 0 ;
337- activity = string . Format ( "Installing {0}..." , pkg . Name ) ;
338- statusDescription = string . Format ( "{0}% Complete:" , Math . Round ( ( ( double ) totalPkgsCount / totalPkgs ) * 100 ) , 2 ) ;
339- currentPkgNumOfDependentPkgs = pkg . Dependencies . Count ( ) ;
340- dependentPkgCount = 1 ;
341- }
342- else
329+ // Will suppress progress bar if -Quiet is passed in
330+ if ( ! _quiet )
343331 {
344- // Installing dependent package
345- activityId = 1 ;
346- activity = string . Format ( "Installing dependent package {0}..." , pkg . Name ) ;
347- statusDescription = string . Format ( "{0}% Complete:" , Math . Round ( ( ( double ) dependentPkgCount / currentPkgNumOfDependentPkgs ) * 100 ) , 2 ) ;
348- dependentPkgCount ++ ;
332+ int activityId = 0 ;
333+ string activity = "" ;
334+ string statusDescription = "" ;
335+
336+ if ( pkgNamesToInstall . ToList ( ) . Contains ( pkg . Name , StringComparer . InvariantCultureIgnoreCase ) )
337+ {
338+ // Installing parent package (one whose name was passed in to install)
339+ activityId = 0 ;
340+ activity = string . Format ( "Installing {0}..." , pkg . Name ) ;
341+ statusDescription = string . Format ( "{0}% Complete:" , Math . Round ( ( ( double ) totalPkgsCount / totalPkgs ) * 100 ) , 2 ) ;
342+ currentPkgNumOfDependentPkgs = pkg . Dependencies . Count ( ) ;
343+ dependentPkgCount = 1 ;
344+ }
345+ else
346+ {
347+ // Installing dependent package
348+ activityId = 1 ;
349+ activity = string . Format ( "Installing dependent package {0}..." , pkg . Name ) ;
350+ statusDescription = string . Format ( "{0}% Complete:" , Math . Round ( ( ( double ) dependentPkgCount / currentPkgNumOfDependentPkgs ) * 100 ) , 2 ) ;
351+ dependentPkgCount ++ ;
352+ }
353+
354+ var progressRecord = new ProgressRecord ( activityId , activity , statusDescription ) ;
355+ _cmdletPassedIn . WriteProgress ( progressRecord ) ;
349356 }
350357
351- var progressRecord = new ProgressRecord ( activityId , activity , statusDescription ) ;
352- _cmdletPassedIn . WriteProgress ( progressRecord ) ;
353-
354358 // Create PackageIdentity in order to download
355359 string createFullVersion = pkg . Version . ToString ( ) ;
356360 if ( pkg . IsPrerelease )
0 commit comments