Skip to content
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: CLI option for setting report cell width #434

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var checkCmd = &cobra.Command{
cfg.expand = !GetFlag(cmd, "raw")
cfg.report = GetFlag(cmd, "report")
cfg.reportPadding = GetUint(cmd, "report-context")
cfg.reportCellWidth = GetUint(cmd, "report-cellwidth")
cfg.spillage = GetInt(cmd, "spillage")
cfg.strict = !GetFlag(cmd, "warn")
cfg.quiet = GetFlag(cmd, "quiet")
Expand Down Expand Up @@ -102,6 +103,8 @@ type checkConfig struct {
// Specifies the number of additional rows to show eitherside of the failing
// area. This essentially allows more contextual information to be shown.
reportPadding uint
// Specifies the width of a cell to show.
reportCellWidth uint
// Perform trace expansion in parallel (or not)
parallelExpansion bool
// Size of constraint batches to execute in parallel
Expand Down Expand Up @@ -263,7 +266,7 @@ func reportConstraintFailure(kind string, handle string, cells *util.AnySortedSe
cols.Insert(c.Column)
}
// Construct & configure printer
tp := tr.NewPrinter().Start(start).End(end).MaxCellWidth(16).Padding(cfg.reportPadding)
tp := tr.NewPrinter().Start(start).End(end).MaxCellWidth(cfg.reportCellWidth).Padding(cfg.reportPadding)
// Determine whether to enable ANSI escapes (e.g. for colour in the terminal)
tp = tp.AnsiEscapes(cfg.ansiEscapes)
// Filter out columns not used in evaluating the constraint.
Expand Down Expand Up @@ -302,6 +305,7 @@ func init() {
rootCmd.AddCommand(checkCmd)
checkCmd.Flags().Bool("report", false, "report details of failure for debugging")
checkCmd.Flags().Uint("report-context", 2, "specify number of rows to show eitherside of failure in report")
checkCmd.Flags().Uint("report-cellwidth", 32, "specify max number of bytes to show in a given cell in the report")
checkCmd.Flags().Bool("raw", false, "assume input trace already expanded")
checkCmd.Flags().Bool("hir", false, "check at HIR level")
checkCmd.Flags().Bool("mir", false, "check at MIR level")
Expand Down
Loading