-
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 #11 in DEVOPS/orgalorg from serial-output to master
* commit '48446c01fd81ac46f504ad74ec8e3dc6cfea5352': 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 fix lock issues
- Loading branch information
Showing
29 changed files
with
917 additions
and
251 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) | ||
} |
Oops, something went wrong.