cmd/ctr: add commit command to snapshot

Signed-off-by: Sunny Gogoi <me@darkowlzz.space>
This commit is contained in:
Sunny Gogoi 2017-07-12 18:03:25 +05:30
parent 28e8d95a64
commit 912ddbae0f

View File

@ -28,6 +28,7 @@ var snapshotCommand = cli.Command{
prepareSnapshotCommand, prepareSnapshotCommand,
treeSnapshotCommand, treeSnapshotCommand,
mountSnapshotCommand, 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{ var treeSnapshotCommand = cli.Command{
Name: "tree", Name: "tree",
Usage: "Display tree view of snapshot branches", Usage: "Display tree view of snapshot branches",