-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 in DEVOPS/orgalorg from status-line to serial-…
…output * commit '450e31436bff0e6ded0dbd1550df8a5c2178803f': fix typos migrate to loreley TTY detection switch to colorgful & barely, add upload status wip make tests pass and update readme update readme refactor styles coloooors
- Loading branch information
Showing
21 changed files
with
734 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
type bytesStringer struct { | ||
Amount int | ||
} | ||
|
||
func (stringer bytesStringer) String() string { | ||
amount := float64(stringer.Amount) | ||
|
||
suffixes := map[string]string{ | ||
"b": "KiB", | ||
"KiB": "MiB", | ||
"MiB": "GiB", | ||
"GiB": "TiB", | ||
} | ||
|
||
suffix := "b" | ||
for amount >= 1024 { | ||
if newSuffix, ok := suffixes[suffix]; ok { | ||
suffix = newSuffix | ||
} else { | ||
break | ||
} | ||
|
||
amount /= 1024 | ||
} | ||
|
||
return fmt.Sprintf("%.2f%s", amount, suffix) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
type ( | ||
callbackWriter func([]byte) (int, error) | ||
) | ||
|
||
func (writer callbackWriter) Write(data []byte) (int, error) { | ||
return writer(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.