Skip to content

Commit

Permalink
out: respect source arg
Browse files Browse the repository at this point in the history
  • Loading branch information
vito committed Sep 29, 2018
1 parent 678235b commit 1cb6faf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/out/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"net/http"
"os"
"path/filepath"

"github.com/fatih/color"
"github.com/google/go-containerregistry/pkg/authn"
Expand Down Expand Up @@ -47,6 +48,14 @@ func main() {
logrus.SetLevel(logrus.DebugLevel)
}

if len(os.Args) < 2 {
logrus.Errorf("destination path not specified")
os.Exit(1)
return
}

src := os.Args[1]

logrus.Warnln("'put' is experimental, untested, and subject to change!")

ref := req.Source.Repository + ":" + req.Source.Tag()
Expand All @@ -58,7 +67,9 @@ func main() {
return
}

img, err := tarball.ImageFromPath(req.Params.Image, nil)
imagePath := filepath.Join(src, req.Params.Image)

img, err := tarball.ImageFromPath(imagePath, nil)
if err != nil {
logrus.Errorf("could not load image from path '%s': %s", req.Params.Image, err)
os.Exit(1)
Expand Down

0 comments on commit 1cb6faf

Please sign in to comment.