Merge pull request #1160 from darkowlzz/1082-snapshot-commit
cmd/ctr: add commit command to snapshot
This commit is contained in:
commit
0f6959a2fc
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user