From b5f54a9b23e8d9418700494da9aa78d8db354c43 Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 15 Mar 2021 14:52:43 -0500 Subject: introduce podman machine podman machine allows podman to create, manage, and interact with a vm running some form of linux (default is fcos). podman is then configured to be able to interact with the vm automatically. while this is usable on linux, the real push is to get this working on both current apple architectures in macos. Ashley Cui contributed to this PR and was a great help. [NO TESTS NEEDED] Signed-off-by: baude --- .../vbauerster/mpb/v6/internal/percentage.go | 19 +++++++++++++++++++ .../vbauerster/mpb/v6/internal/predicate.go | 6 ++++++ vendor/github.com/vbauerster/mpb/v6/internal/width.go | 10 ++++++++++ 3 files changed, 35 insertions(+) create mode 100644 vendor/github.com/vbauerster/mpb/v6/internal/percentage.go create mode 100644 vendor/github.com/vbauerster/mpb/v6/internal/predicate.go create mode 100644 vendor/github.com/vbauerster/mpb/v6/internal/width.go (limited to 'vendor/github.com/vbauerster/mpb/v6/internal') diff --git a/vendor/github.com/vbauerster/mpb/v6/internal/percentage.go b/vendor/github.com/vbauerster/mpb/v6/internal/percentage.go new file mode 100644 index 000000000..a8ef8be12 --- /dev/null +++ b/vendor/github.com/vbauerster/mpb/v6/internal/percentage.go @@ -0,0 +1,19 @@ +package internal + +import "math" + +// Percentage is a helper function, to calculate percentage. +func Percentage(total, current int64, width int) float64 { + if total <= 0 { + return 0 + } + if current >= total { + return float64(width) + } + return float64(int64(width)*current) / float64(total) +} + +// PercentageRound same as Percentage but with math.Round. +func PercentageRound(total, current int64, width int) float64 { + return math.Round(Percentage(total, current, width)) +} diff --git a/vendor/github.com/vbauerster/mpb/v6/internal/predicate.go b/vendor/github.com/vbauerster/mpb/v6/internal/predicate.go new file mode 100644 index 000000000..1e4dd24d9 --- /dev/null +++ b/vendor/github.com/vbauerster/mpb/v6/internal/predicate.go @@ -0,0 +1,6 @@ +package internal + +// Predicate helper for internal use. +func Predicate(pick bool) func() bool { + return func() bool { return pick } +} diff --git a/vendor/github.com/vbauerster/mpb/v6/internal/width.go b/vendor/github.com/vbauerster/mpb/v6/internal/width.go new file mode 100644 index 000000000..216320f24 --- /dev/null +++ b/vendor/github.com/vbauerster/mpb/v6/internal/width.go @@ -0,0 +1,10 @@ +package internal + +// CheckRequestedWidth checks that requested width doesn't overflow +// available width +func CheckRequestedWidth(requested, available int) int { + if requested <= 0 || requested >= available { + return available + } + return requested +} -- cgit v1.2.3-54-g00ecf