Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extract print helpers into print_tables.go#9

Open
wydrox wants to merge 1 commit into
main from
refactor/extract-print-tables
Open

Extract print helpers into print_tables.go #9
wydrox wants to merge 1 commit into
main from
refactor/extract-print-tables

Conversation

@wydrox

@wydrox wydrox commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move nine print*Table / printCartSummary renderers out of account_cmd.go, orders_cmd.go, products_cmd.go, reservation_cmd.go, cart_cmd.go into a new internal/commands/print_tables.go.
  • Shared helpers (cellValue, hhmm, formatStreet, parseMoneyFloat, parseGrammageKg, toFloat, toSlice, asString, asInt, fallbackDash) and display-adjacent types (cartShowOpts, cartItem, orderProduct) remain in their original files because non-print code still uses them.
  • Pure cut-and-paste; function signatures unchanged. Unused sort imports removed from the four source files that no longer need them; other imports left intact.

Test plan

  • go vet ./...
  • go test ./... -race
  • go build -o bin/martmart ./cmd/martmart
  • ./bin/martmart --help, config show, cart show --help, products search --help, reservation slots --help
  • Existing print_tables_test.go (490 lines) still passes against the relocated functions without modification.

Move the nine table/summary renderers (printProfileTable,
printAddressesTable, printConsentsTable, printPaymentsTable,
printPointsHistoryTable, printOrderProductsTable, printProductSearchTable,
printSlotsTable, printCartSummary) out of their individual *_cmd.go files
and into a dedicated print_tables.go. Shared helpers and display-adjacent
types stay where they are. Pure cut-and-paste with unused imports pruned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /