diff --git a/src/CostApi/AzureCostApiRetriever.cs b/src/CostApi/AzureCostApiRetriever.cs index f744e27..d26cd2b 100644 --- a/src/CostApi/AzureCostApiRetriever.cs +++ b/src/CostApi/AzureCostApiRetriever.cs @@ -48,7 +48,7 @@ private async Task RetrieveToken(bool includeDebugOutput) if (_tokenRetrieved) return; - // Get the token by using the DefaultAzureCredential + // Get the token by using the DefaultAzureCredential, but try the AzureCliCredential first var tokenCredential = new ChainedTokenCredential( new AzureCliCredential(), new DefaultAzureCredential()); diff --git a/src/OutputFormatters/SpectreConsole/Money.cs b/src/OutputFormatters/SpectreConsole/Money.cs index 0b36b2b..6a4eec5 100644 --- a/src/OutputFormatters/SpectreConsole/Money.cs +++ b/src/OutputFormatters/SpectreConsole/Money.cs @@ -7,10 +7,9 @@ namespace AzureCostCli.OutputFormatters.SpectreConsole; public class Money : Renderable { private readonly Markup _paragraph; - + public Money(double amount, string currency, Style? style = null, Justify justify = Justify.Right) { - _paragraph = new Markup(FormatMoney(amount, currency), style) { Justification = justify @@ -25,24 +24,22 @@ protected override IEnumerable Render(RenderOptions options, int maxWid public static string FormatMoney(double amount, string currency) { - -// Get current culture info + // Get current culture info var cultureInfo = CultureInfo.CurrentCulture; -// Get culture specific decimal separator + // Get culture specific decimal separator var decimalSeparator = cultureInfo.NumberFormat.NumberDecimalSeparator; -// Get culture specific thousand separator + // Get culture specific thousand separator var thousandSeparator = cultureInfo.NumberFormat.NumberGroupSeparator; -// Split the amount into integer and fraction parts + // Split the amount into integer and fraction parts var amountParts = amount.ToString("N2", cultureInfo).Split(decimalSeparator); string amountInteger = amountParts[0]; string amountFraction = amountParts.Length > 1 ? amountParts[1] : "00"; -// Prepare styled string - string styledAmount = $"[bold dim]{amountInteger}[/]{decimalSeparator}[dim]{amountFraction}[/] [green]{currency}[/]"; + // Prepare styled string + string styledAmount = + $"[bold dim]{amountInteger}[/]{decimalSeparator}[dim]{amountFraction}[/] [green]{currency}[/]"; return styledAmount; - } - } \ No newline at end of file