From 912ddbae0f19aee5521008a04cb9ee3be5f1c972 Mon Sep 17 00:00:00 2001 From: Sunny Gogoi Date: Wed, 12 Jul 2017 18:03:25 +0530 Subject: [PATCH] cmd/ctr: add commit command to snapshot Signed-off-by: Sunny Gogoi --- cmd/ctr/snapshot.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cmd/ctr/snapshot.go b/cmd/ctr/snapshot.go index 400a9eb8c..46f2e9b1a 100644 --- a/cmd/ctr/snapshot.go +++ b/cmd/ctr/snapshot.go @@ -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] ", + 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",