diff --git a/cmd/oras/internal/display/prompt/prompt.go b/cmd/oras/internal/display/prompt/prompt.go deleted file mode 100644 index 250b81638..000000000 --- a/cmd/oras/internal/display/prompt/prompt.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright The ORAS Authors. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package prompt - -import ( - "fmt" - "reflect" -) - -var () - -type prompt struct { - Copying, Skipped, Exists, Copied, Downloading, Downloaded string -} - -func New() *prompt { - var p prompt - p.pad() - return &p -} - -// pad appends the prompt strings with spaces to make them the same length. -func (p *prompt) pad() { - v := reflect.ValueOf(p).Elem() - t := v.Type() - maxLen := 0 - - for i := 0; i < v.NumField(); i++ { - f := v.Field(i) - if f.IsValid() && f.CanSet() && f.Kind() == reflect.String { - sf := t.Field(i) - len := len(sf.Name) - if len > maxLen { - maxLen = len - } - } - - } - - for i := 0; i < v.NumField(); i++ { - f := v.Field(i) - if f.IsValid() && f.CanSet() && f.Kind() == reflect.String { - sf := t.Field(i) - f.SetString(fmt.Sprintf("%-*s", maxLen, sf.Name)) - } - } -}