mirror of
https://github.com/containers/skopeo.git
synced 2026-07-14 13:48:32 +00:00
This patch will allow commands like buildah run $ctr ls -lZ / To work correctly. Need to update vendor of urfave cli. Also changed all commands to no longer accept global options after the COMMAND. Single boolean options can now be passed together. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #493 Approved by: rhatdan
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
"strconv"
|
|
"time"
|
|
|
|
ispecs "github.com/opencontainers/image-spec/specs-go"
|
|
rspecs "github.com/opencontainers/runtime-spec/specs-go"
|
|
"github.com/projectatomic/buildah"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
//Overwritten at build time
|
|
var (
|
|
gitCommit string
|
|
buildInfo string
|
|
)
|
|
|
|
//Function to get and print info for version command
|
|
func versionCmd(c *cli.Context) error {
|
|
|
|
//converting unix time from string to int64
|
|
buildTime, err := strconv.ParseInt(buildInfo, 10, 64)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println("Version: ", buildah.Version)
|
|
fmt.Println("Go Version: ", runtime.Version())
|
|
fmt.Println("Image Spec: ", ispecs.Version)
|
|
fmt.Println("Runtime Spec: ", rspecs.Version)
|
|
fmt.Println("Git Commit: ", gitCommit)
|
|
|
|
//Prints out the build time in readable format
|
|
fmt.Println("Built: ", time.Unix(buildTime, 0).Format(time.ANSIC))
|
|
fmt.Println("OS/Arch: ", runtime.GOOS+"/"+runtime.GOARCH)
|
|
|
|
return nil
|
|
}
|
|
|
|
//cli command to print out the version info of buildah
|
|
var versionCommand = cli.Command{
|
|
Name: "version",
|
|
Usage: "Display the Buildah Version Information",
|
|
Action: versionCmd,
|
|
SkipArgReorder: true,
|
|
}
|