Skip to content

Add WithPadding for independent top and bottom banner padding - #9

Merged
polymorcodeus merged 1 commit into
mainfrom
withpadding
Aug 29, 2026
Merged

Add WithPadding for independent top and bottom banner padding#9
polymorcodeus merged 1 commit into
mainfrom
withpadding

Conversation

@polymorcodeus

Copy link
Copy Markdown
Owner

Summary

Adds WithPadding(top, bottom int) so callers can set top and bottom banner padding independently. Keeps WithZeroPadding() as a compatibility wrapper for WithPadding(0, 0). Closes#8.

What's new

  • Independent padding control - WithPadding(top, bottom int) sets the number of leading and trailing newlines separately.
  • Backward-compatible helper - WithZeroPadding() now delegates to WithPadding(0, 0) and continues to disable the default top padding.
  • Bottom padding support - Banner.BottomPadding holds the trailing newline count and is applied in CmdBanner.

Behavior changes / guardrails

  • Banner.TopPadding changed from bool to int to support multiple leading newlines; existing callers using the functional options are unaffected.
  • NewCmdBanner defaults to TopPadding: 1 and BottomPadding: 0, preserving the previous single-leading-newline default.
  • Negative padding values loop zero times (Go's for i := 0; i < n semantics), so callers should pass non-negative integers.

Testing

  • Added banner_test.go with tests for default padding, WithPadding, top padding, bottom padding, and zero padding.
  • go test ./..., go vet ./..., and go fmt ./... are all green.

@polymorcodeuspolymorcodeus self-assigned this Aug 29, 2026
@polymorcodeus
polymorcodeus merged commit 8a9a389 into mainAug 29, 2026
2 checks passed
@polymorcodeus
polymorcodeus deleted the withpadding branch August 29, 2026 04:56
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add WithPadding() that supports setting both top/bottom padding independly

1 participant

@polymorcodeus