feature(main): add cmd feature for main branch (#934)

* feature(main): add cmd feature for main branch

* feature(main): add copy link for copy file
This commit is contained in:
cuisongliu
2022-04-17 01:29:37 +08:00
committed by GitHub
parent e933c203c4
commit cb3f2e1b9c
19 changed files with 885 additions and 116 deletions
+5 -19
View File
@@ -18,6 +18,7 @@ package binary
import (
"fmt"
"os"
"path/filepath"
"strings"
@@ -110,25 +111,10 @@ func (d *ImageService) Prune() error {
return exec.CmdForPipe("bash", "-c", "buildah rmi --prune")
}
func (d *ImageService) ListImages() ([]types.ImageInfo, error) {
data := exec.BashEval("buildah images --json")
infos, err := listImage(data)
if err != nil {
return nil, err
}
return infos, nil
}
func listImage(data string) ([]types.ImageInfo, error) {
if data != "" {
var outStruct []types.ImageInfo
err := json.Unmarshal([]byte(data), &outStruct)
if err != nil {
return nil, errors.Wrap(err, "decode out json from list images failed")
}
return outStruct, nil
}
return nil, errors.New("images output is empty")
func (d *ImageService) ListImages() error {
data, err := exec.RunBashCmd("buildah images")
_, _ = os.Stdout.Write([]byte(data))
return err
}
func NewImageService() (types.Service, error) {