File: download.go

package info (click to toggle)
golang-github-mudler-docker-companion 0.4.5%2Bgit20250528.7d707b9%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: makefile: 31
file content (25 lines) | stat: -rw-r--r-- 594 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
	"os"

	"github.com/urfave/cli"
	"github.com/mudler/docker-companion/api"
)

func downloadImage(c *cli.Context) error {

	var sourceImage string
	var output string
	if c.NArg() == 2 {
		sourceImage = c.Args()[0]
		output = c.Args()[1]
	} else {
		return cli.NewExitError("This command requires to argument: source-image output-folder(absolute)", 86)
	}
	unpackmode := os.Getenv("UNPACK_MODE")
	if unpackmode == "" {
		unpackmode = "umoci"
	}
	return api.DownloadAndUnpackImage(sourceImage, output, &api.DownloadOpts{KeepLayers: c.Bool("keep"), UnpackMode: unpackmode})
}