Skip to content

Commit

Permalink
Merge pull request #8337 from cormacpayne/fix-deployment-formatting
Browse files Browse the repository at this point in the history
Fix formatting issue with PSResourceGroupDeployment object
  • Loading branch information
cormacpayne authored Jan 17, 2019
2 parents 5460ac7 + 2975581 commit 0b62117
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,20 @@ public static string ConstructDeploymentVariableTable(Dictionary<string, Deploym
return null;
}

var maxNameLength = 15;
dictionary.Keys.ForEach(k => maxNameLength = Math.Max(maxNameLength, k.Length + 2));

var maxTypeLength = 25;
dictionary.Values.ForEach(v => maxTypeLength = Math.Max(maxTypeLength, v.Type.Length + 2));

StringBuilder result = new StringBuilder();

if (dictionary.Count > 0)
{
string rowFormat = "{0, -15} {1, -25} {2, -10}\r\n";
string rowFormat = "{0, -" + maxNameLength +"} {1, -" + maxTypeLength + "} {2, -10}\r\n";
result.AppendLine();
result.AppendFormat(rowFormat, "Name", "Type", "Value");
result.AppendFormat(rowFormat, GeneralUtilities.GenerateSeparator(15, "="), GeneralUtilities.GenerateSeparator(25, "="), GeneralUtilities.GenerateSeparator(10, "="));
result.AppendFormat(rowFormat, GeneralUtilities.GenerateSeparator(maxNameLength, "="), GeneralUtilities.GenerateSeparator(maxTypeLength, "="), GeneralUtilities.GenerateSeparator(10, "="));

foreach (KeyValuePair<string, DeploymentVariable> pair in dictionary)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
-->
## Upcoming Release
* Fix incorrect examples in `New-AzADAppCredential` and `New-AzADSpCredential` reference documentation
* Fix formatting issue with `PSResourceGroupDeployment` object
- More information here: https://github.com/Azure/azure-powershell/issues/2123

## Version 1.1.0
* Fix parameter set issue when providing `-ODataQuery` and `-ResourceId` parameters for `Get-AzResource`
Expand Down

0 comments on commit 0b62117

Please sign in to comment.