Merge pull request #1160 from darkowlzz/1082-snapshot-commit

cmd/ctr: add commit command to snapshot
This commit is contained in:
Derek McGowan 2017-07-21 10:58:57 -07:00 committed by GitHub
commit 0f6959a2fc

View File

@ -28,6 +28,7 @@ var snapshotCommand = cli.Command{
prepareSnapshotCommand,
treeSnapshotCommand,
mountSnapshotCommand,
commitSnapshotCommand,
},
}
@ -290,6 +291,30 @@ var mountSnapshotCommand = cli.Command{
},
}
var commitSnapshotCommand = cli.Command{
Name: "commit",
Usage: "commit creates a new snapshot with diff from parent snapshot",
ArgsUsage: "[flags] <id> <target>",
Action: func(clicontext *cli.Context) error {
ctx, cancel := appContext(clicontext)
defer cancel()
if clicontext.NArg() != 2 {
return cli.ShowSubcommandHelp(clicontext)
}
id := clicontext.Args().Get(0)
target := clicontext.Args().Get(1)
snapshotter, err := getSnapshotter(clicontext)
if err != nil {
return err
}
return snapshotter.Commit(ctx, target, id)
},
}
var treeSnapshotCommand = cli.Command{
Name: "tree",
Usage: "Display tree view of snapshot branches",