-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add table output to diff
#2454
Conversation
Adds summary table to diff output to improve understanding about cost diffs between projects. This table only shows porjects with cost diffs. Zero diff projects are ignored to make this consistent with GitHub comments. Along with the table this PR also: * removes the verbose "no cost estimate change" line to just be a count unless --show-skipped is included * reformats the errored projects to be above the table so that the table is explicitly the last output
@hugorut when I have a change in project with a long name the wrapping looks a bit odd. Should we:
|
Also, should we right-align the |
internal/output/diff.go
Outdated
t.SetStyle(table.StyleBold) | ||
t.Style().Format.Header = text.FormatDefault | ||
t.AppendHeader(table.Row{ | ||
"Name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Name", | |
"Project", |
To keep it consistent with Infracost comment
internal/output/diff.go
Outdated
s += fmt.Sprintf("\nThe following projects have no cost estimate changes: %s", strings.Join(noDiffProjects, ", ")) | ||
s += fmt.Sprintf("\nRun the following command to see their breakdown: %s", ui.PrimaryString("infracost breakdown --path=/path/to/code")) | ||
s += "\n\n" | ||
if hasDiffProjects && out.DiffTotalMonthlyCost != nil && out.DiffTotalMonthlyCost.GreaterThan(decimal.Zero) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hides any decreasing costs. I think this should check the absolute value of out.DiffTotalMonthlyCost
Are projects shown based on the same logic as the comment's showProject
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hides any decreasing costs. I think this should check the absolute value of out.DiffTotalMonthlyCost
👍
Are projects shown based on the same logic as the comment's showProject function?
No but i'll update so it does
This is great! A few suggestions:
|
👍
👍 |
* use `showProject` logic to hide/show projects * truncate long project names * add overview cost increase line * remove colours from table * align table columns
@aliscott I've made changes request by you and ali, table looks like this now:
I've made the following changes:
@alikhajeh1 the table already uses the rounding logic so I'm not sure if you've see something different? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ it
@hugorut re the rounding, it only works on positive numbers, if the diff is <0 then we always seem to show decimals. Can we change that behavior so the absolute value is used to decide?
|
Adds summary table to diff output to improve understanding about cost diffs between projects. This table only shows projects with cost diffs. e.g:
Zero diff projects are ignored to make this consistent with GitHub comments. This PR also: