Repository: pterm/pterm
Pull request #70 (2020-10-21 14:16:05)

refactor: change `LineCharacter` to `BarCharacter`
### Description
Changed Line to bar
I tested it and I think it works but double check because I am really new to go.

### Scope
> What is affected by this pull request?
Line is now defined as bar
- [x] Bug Fix
- [ ] New Feature
- [ ] Documentation
- [ ] Other


### To-Do Checklist
- [x] I tested my changes
- [x] I have commented every method that I created/changed
- [x] I updated the examples to fit with my changes
- [x] I have added tests for my newly created methods


codecov[bot]: # [Codecov](https://codecov.io/gh/pterm/pterm/pull/70?src=pr&el=h1) Report
> Merging [#70](https://codecov.io/gh/pterm/pterm/pull/70?src=pr&el=desc) into [master](https://codecov.io/gh/pterm/pterm/commit/4e78cfa971a30c901f3e9557a663b984b52f7f21?el=desc) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/pterm/pterm/pull/70/graphs/tree.svg?width=650&height=150&src=pr&token=C3EX231V76)](https://codecov.io/gh/pterm/pterm/pull/70?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##            master       #70   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           14        14           
  Lines          497       497           
=========================================
  Hits           497       497           
```


| [Impacted Files](https://codecov.io/gh/pterm/pterm/pull/70?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [progressbar.go](https://codecov.io/gh/pterm/pterm/pull/70/diff?src=pr&el=tree#diff-cHJvZ3Jlc3NiYXIuZ28=) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pterm/pterm/pull/70?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pterm/pterm/pull/70?src=pr&el=footer). Last update [4e78cfa...fc7b2f6](https://codecov.io/gh/pterm/pterm/pull/70?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/progressbar.go b/progressbar.go
index 9c9ed3b1..3ae39ac4 100644
--- a/progressbar.go
+++ b/progressbar.go
@@ -18,7 +18,7 @@ var (
 	// DefaultProgressbar is the default progressbar.
 	DefaultProgressbar = Progressbar{
 		Total:                     100,
-		LineCharacter:             "█",
+		BarCharacter:              "█",
 		LastCharacter:             "█",
 		ElapsedTimeRoundingFactor: time.Second,
 		BarStyle:                  &ThemeDefault.ProgressbarBarStyle,
@@ -37,7 +37,7 @@ type Progressbar struct {
 	Total                     int
 	Current                   int
 	UpdateDelay               time.Duration
-	LineCharacter             string
+	BarCharacter              string
 	LastCharacter             string
 	ElapsedTimeRoundingFactor time.Duration
 	BarFiller                 string
@@ -80,9 +80,9 @@ func (p Progressbar) WithUpdateDelay(delay time.Duration) *Progressbar {
 	return &p
 }
 
-// WithLineCharacter sets the line character of the progressbar.
-func (p Progressbar) WithLineCharacter(char string) *Progressbar {
-	p.LineCharacter = char
+// WithBarCharacter sets the bar character of the progressbar.
+func (p Progressbar) WithBarCharacter(char string) *Progressbar {
+	p.BarCharacter = char
 	return &p
 }
 
@@ -194,7 +194,7 @@ func (p *Progressbar) Add(count int) *Progressbar {
 	barCurrentLength := (p.Current * barMaxLength) / p.Total
 	barFiller := strings.Repeat(p.BarFiller, barMaxLength-barCurrentLength)
 
-	bar := p.BarStyle.Sprint(strings.Repeat(p.LineCharacter, barCurrentLength)+p.LastCharacter) + barFiller
+	bar := p.BarStyle.Sprint(strings.Repeat(p.BarCharacter, barCurrentLength)+p.LastCharacter) + barFiller
 	Printo(before + bar + after)
 
 	if p.Current == p.Total {


Test patch:
diff --git a/progressbar_test.go b/progressbar_test.go
index d0f2c697..078d2d1b 100644
--- a/progressbar_test.go
+++ b/progressbar_test.go
@@ -82,11 +82,11 @@ func TestProgressbar_WithLastCharacter(t *testing.T) {
 	assert.Equal(t, ">", p2.LastCharacter)
 }
 
-func TestProgressbar_WithLineCharacter(t *testing.T) {
+func TestProgressbar_WithBarCharacter(t *testing.T) {
 	p := Progressbar{}
-	p2 := p.WithLineCharacter("-")
+	p2 := p.WithBarCharacter("-")
 
-	assert.Equal(t, "-", p2.LineCharacter)
+	assert.Equal(t, "-", p2.BarCharacter)
 }
 
 func TestProgressbar_WithRemoveWhenDone(t *testing.T) {