Skip to content

Commit

Permalink
rename to WithWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooke Hatton committed Mar 23, 2022
1 parent 269e2a2 commit 28fd8c1
Show file tree
Hide file tree
Showing 30 changed files with 1,348 additions and 314 deletions.
4 changes: 2 additions & 2 deletions barchart.go
Expand Up @@ -83,8 +83,8 @@ func (p BarChartPrinter) WithShowValue(b ...bool) *BarChartPrinter {
return &p
}

// WithCustomWriter sets the custom Writer.
func (p BarChartPrinter) WithCustomWriter(writer io.Writer) *BarChartPrinter {
// WithWriter sets the custom Writer.
func (p BarChartPrinter) WithWriter(writer io.Writer) *BarChartPrinter {
p.Writer = writer
return &p
}
Expand Down
2 changes: 1 addition & 1 deletion basic_text_printer.go
Expand Up @@ -23,7 +23,7 @@ func (p BasicTextPrinter) WithStyle(style *Style) *BasicTextPrinter {
return &p
}

func (p BasicTextPrinter) WithCustomWriter(writer io.Writer) *BasicTextPrinter {
func (p BasicTextPrinter) WithWriter(writer io.Writer) *BasicTextPrinter {
p.Writer = writer
return &p
}
Expand Down
4 changes: 2 additions & 2 deletions bigtext_printer.go
Expand Up @@ -99,8 +99,8 @@ func (p BigTextPrinter) WithLetters(letters ...Letters) *BigTextPrinter {
return &p
}

// WithCustomWriter sets the custom Writer.
func (p BigTextPrinter) WithCustomWriter(writer io.Writer) *BigTextPrinter {
// WithWriter sets the custom Writer.
func (p BigTextPrinter) WithWriter(writer io.Writer) *BigTextPrinter {
p.Writer = writer
return &p
}
Expand Down
4 changes: 2 additions & 2 deletions box_printer.go
Expand Up @@ -213,8 +213,8 @@ func (p BoxPrinter) WithLeftPadding(padding int) *BoxPrinter {
return &p
}

// WithCustomWriter sets the custom Writer.
func (p BoxPrinter) WithCustomWriter(writer io.Writer) *BoxPrinter {
// WithWriter sets the custom Writer.
func (p BoxPrinter) WithWriter(writer io.Writer) *BoxPrinter {
p.Writer = writer
return &p
}
Expand Down
4 changes: 2 additions & 2 deletions bulletlist_printer.go
Expand Up @@ -109,8 +109,8 @@ func (l BulletListPrinter) WithBulletStyle(style *Style) *BulletListPrinter {
return &l
}

// WithCustomWriter sets the custom Writer.
func (l BulletListPrinter) WithCustomWriter(writer io.Writer) *BulletListPrinter {
// WithWriter sets the custom Writer.
func (l BulletListPrinter) WithWriter(writer io.Writer) *BulletListPrinter {
l.Writer = writer
return &l
}
Expand Down
4 changes: 2 additions & 2 deletions center_printer.go
Expand Up @@ -28,8 +28,8 @@ func (p CenterPrinter) WithCenterEachLineSeparately(b ...bool) *CenterPrinter {
return &p
}

// WithCustomWriter sets the custom Writer.
func (p CenterPrinter) WithCustomWriter(writer io.Writer) *CenterPrinter {
// WithWriter sets the custom Writer.
func (p CenterPrinter) WithWriter(writer io.Writer) *CenterPrinter {
p.Writer = writer
return &p
}
Expand Down
1,030 changes: 1,030 additions & 0 deletions coverage.txt

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions docs/docs/printer/barchart.md
@@ -1,6 +1,6 @@
# BarChartPrinter

<!--
<!--
Replace all of the following strings with the current printer.
barchart BarChart BarChartPrinter DefaultBarChart
-->
Expand All @@ -9,7 +9,6 @@ Replace all of the following strings with the current printer.

<p align="center"><a href="https://github.com/pterm/pterm/blob/master/_examples/barchart/main.go" target="_blank">(Show source of demo)</a></p>


## Usage

### Basic usage
Expand Down Expand Up @@ -47,17 +46,19 @@ bars := pterm.Bars{
> [!TIP]
> Click the options and types to show the documentation on _pkg.go.dev_
|Option|Type|
|------|----|
|[Bars](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Bars)|[Bars](https://pkg.go.dev/github.com/pterm/pterm#Bars)|
|[Horizontal](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Horizontal)|bool|
|[ShowValue](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.ShowValue)|bool|
|[Height](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Height)|int|
|[Width](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Width)|int|
|[VerticalBarCharacter](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.VerticalBarCharacter)|string|
|[HorizontalBarCharacter](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.HorizontalBarCharacter)|string|
| Option | Type |
| ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| [Bars](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Bars) | [Bars](https://pkg.go.dev/github.com/pterm/pterm#Bars) |
| [Horizontal](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Horizontal) | bool |
| [ShowValue](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.ShowValue) | bool |
| [Height](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Height) | int |
| [Width](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.Width) | int |
| [VerticalBarCharacter](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.VerticalBarCharacter) | string |
| [HorizontalBarCharacter](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.HorizontalBarCharacter) | string |
| [Writer](https://pkg.go.dev/github.com/pterm/pterm#BarChartPrinter.WithWriter) | io.Writer |

### Output functions

<!-- Remove comment of the correct interface -->

<!--
Expand All @@ -75,10 +76,10 @@ bars := pterm.Bars{

> This printer implements the interface [`RenderablePrinter`](https://github.com/pterm/pterm/blob/master/interface_renderable_printer.go)
|Function|Description|
|------|---------|
|Render()|Prints to Terminal|
|Srender()|Returns a string|
| Function | Description |
| --------- | ------------------ |
| Render() | Prints to Terminal |
| Srender() | Returns a string |

<!--
> This printer implements the interface [`LivePrinter`](https://github.com/pterm/pterm/blob/master/interface_live_printer.go)
Expand All @@ -96,4 +97,5 @@ bars := pterm.Bars{
-->

## Related
- [Override default printers](docs/customizing/override-default-printer.md)

- [Override default printers](docs/customizing/override-default-printer.md)
33 changes: 17 additions & 16 deletions docs/docs/printer/basictext.md
@@ -1,6 +1,6 @@
# BasicTextPrinter

<!--
<!--
Replace all of the following strings with the current printer.
basictext BasicText BasicTextPrinter DefaultBasicText
-->
Expand All @@ -9,7 +9,6 @@ Replace all of the following strings with the current printer.

<p align="center"><a href="https://github.com/pterm/pterm/blob/master/_examples/basictext/main.go" target="_blank">(Show source of demo)</a></p>


## Usage

### Basic usage
Expand All @@ -29,24 +28,26 @@ pterm.DefaultBasicText.Println("Hello, World!")
> [!TIP]
> Click the options and types to show the documentation on _pkg.go.dev_
|Option|Type|
|------|----|
|[Style](https://pkg.go.dev/github.com/pterm/pterm#BasicTextPrinter.WithStyle)|[*Style](https://pkg.go.dev/github.com/pterm/pterm#Style)|
| Option | Type |
| ------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [Style](https://pkg.go.dev/github.com/pterm/pterm#BasicTextPrinter.WithStyle) | [\*Style](https://pkg.go.dev/github.com/pterm/pterm#Style) |
| [Writer](https://pkg.go.dev/github.com/pterm/pterm#BasicTextPrinter.WithWriter) | io.Writer |

### Output functions

> This printer implements the interface [`TextPrinter`](https://github.com/pterm/pterm/blob/master/interface_text_printer.go)
|Function|Description|
|------|---------|
|Sprint(a ...interface{})|Returns a string|
|Sprintln(a ...interface{})|Returns a string with a new line at the end|
|Sprintf(format string, a ...interface{})|Returns a string, formatted according to a format specifier|
|Sprintfln(format string, a ...interface{})|Returns a string, formatted according to a format specifier with a new line at the end|
|Print(a ...interface{})|Prints to the terminal|
|Println(a ...interface{})|Prints to the terminal with a new line at the end|
|Printf(format string, a ...interface{})|Prints to the terminal, formatted according to a format specifier|
|Printfln(format string, a ...interface{})|Prints to the terminal, formatted according to a format specifier with a new line at the end|
| Function | Description |
| ------------------------------------------ | -------------------------------------------------------------------------------------------- |
| Sprint(a ...interface{}) | Returns a string |
| Sprintln(a ...interface{}) | Returns a string with a new line at the end |
| Sprintf(format string, a ...interface{}) | Returns a string, formatted according to a format specifier |
| Sprintfln(format string, a ...interface{}) | Returns a string, formatted according to a format specifier with a new line at the end |
| Print(a ...interface{}) | Prints to the terminal |
| Println(a ...interface{}) | Prints to the terminal with a new line at the end |
| Printf(format string, a ...interface{}) | Prints to the terminal, formatted according to a format specifier |
| Printfln(format string, a ...interface{}) | Prints to the terminal, formatted according to a format specifier with a new line at the end |

## Related
- [Override default printers](docs/customizing/override-default-printer.md)

- [Override default printers](docs/customizing/override-default-printer.md)
23 changes: 13 additions & 10 deletions docs/docs/printer/bigtext.md
@@ -1,6 +1,6 @@
# BigTextPrinter

<!--
<!--
Replace all of the following strings with the current printer.
bigtext BigText BigTextPrinter DefaultBigText
-->
Expand Down Expand Up @@ -28,12 +28,14 @@ pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("Hello")).Render()
> [!TIP]
> Click the options and types to show the documentation on _pkg.go.dev_
|Option|Type|
|------|----|
|[Letters](https://pkg.go.dev/github.com/pterm/pterm#BigTextPrinter.WithLetters)|[Letters](https://pkg.go.dev/github.com/pterm/pterm#Letters)|
|[BigCharacters](https://pkg.go.dev/github.com/pterm/pterm#BigTextPrinter.WithBigCharacters)|map[string]string|
| Option | Type |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [Letters](https://pkg.go.dev/github.com/pterm/pterm#BigTextPrinter.WithLetters) | [Letters](https://pkg.go.dev/github.com/pterm/pterm#Letters) |
| [BigCharacters](https://pkg.go.dev/github.com/pterm/pterm#BigTextPrinter.WithBigCharacters) | map[string]string |
| [Writer](https://pkg.go.dev/github.com/pterm/pterm#BigTextPrinter.WithWriter) | io.Writer |

### Output functions

<!-- Remove comment of the correct interface -->

<!--
Expand All @@ -51,10 +53,10 @@ pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("Hello")).Render()

> This printer implements the interface [`RenderablePrinter`](https://github.com/pterm/pterm/blob/master/interface_renderable_printer.go)
|Function|Description|
|------|---------|
|Render()|Prints to Terminal|
|Srender()|Returns a string|
| Function | Description |
| --------- | ------------------ |
| Render() | Prints to Terminal |
| Srender() | Returns a string |

<!--
> This printer implements the interface [`LivePrinter`](https://github.com/pterm/pterm/blob/master/interface_live_printer.go)
Expand All @@ -72,4 +74,5 @@ pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("Hello")).Render()
-->

## Related
- [Override default printers](docs/customizing/override-default-printer.md)

- [Override default printers](docs/customizing/override-default-printer.md)

0 comments on commit 28fd8c1

Please sign in to comment.