...

Source file src/github.com/Microsoft/hcsshim/cmd/wclayer/wclayer.go

Documentation: github.com/Microsoft/hcsshim/cmd/wclayer

     1  //go:build windows
     2  
     3  package main
     4  
     5  import (
     6  	"errors"
     7  	"fmt"
     8  	"os"
     9  	"path/filepath"
    10  
    11  	"github.com/Microsoft/hcsshim"
    12  	"github.com/urfave/cli"
    13  )
    14  
    15  // Add a manifest to get proper Windows version detection.
    16  //go:generate go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific
    17  
    18  var usage = `Windows Container layer utility
    19  
    20  wclayer is a command line tool for manipulating Windows Container
    21  storage layers. It can import and export layers from and to OCI format
    22  layer tar files, create new writable layers, and mount and unmount
    23  container images.`
    24  
    25  var driverInfo = hcsshim.DriverInfo{}
    26  
    27  func main() {
    28  	app := cli.NewApp()
    29  	app.Name = "wclayer"
    30  	app.Commands = []cli.Command{
    31  		createCommand,
    32  		exportCommand,
    33  		importCommand,
    34  		makeBaseLayerCommand,
    35  		mountCommand,
    36  		removeCommand,
    37  		unmountCommand,
    38  	}
    39  	app.Usage = usage
    40  
    41  	if err := app.Run(os.Args); err != nil {
    42  		fmt.Fprintln(os.Stderr, err)
    43  		os.Exit(1)
    44  	}
    45  }
    46  
    47  func normalizeLayers(il []string, needOne bool) ([]string, error) {
    48  	if needOne && len(il) == 0 {
    49  		return nil, errors.New("at least one read-only layer must be specified")
    50  	}
    51  	ol := make([]string, len(il))
    52  	for i := range il {
    53  		var err error
    54  		ol[i], err = filepath.Abs(il[i])
    55  		if err != nil {
    56  			return nil, err
    57  		}
    58  	}
    59  	return ol, nil
    60  }
    61  

View as plain text