ctr: move content command

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo 2017-10-25 13:22:53 -07:00
parent f980cc197e
commit 0895dbe932
2 changed files with 31 additions and 32 deletions

View File

@ -1,4 +1,4 @@
package main package content
import ( import (
"fmt" "fmt"
@ -21,26 +21,26 @@ import (
) )
var ( var (
contentCommand = cli.Command{ // Command is the cli command for managing content
Command = cli.Command{
Name: "content", Name: "content",
Usage: "manage content", Usage: "manage content",
Subcommands: cli.Commands{ Subcommands: cli.Commands{
listContentCommand, listCommand,
ingestContentCommand, ingestCommand,
activeIngestCommand, activeIngestCommand,
getContentCommand, getCommand,
editContentCommand, editCommand,
deleteContentCommand, deleteCommand,
labelContentCommand, setLabelsCommand,
}, },
} }
getContentCommand = cli.Command{ getCommand = cli.Command{
Name: "get", Name: "get",
Usage: "get the data for an object", Usage: "get the data for an object",
ArgsUsage: "[flags] [<digest>, ...]", ArgsUsage: "[<digest>, ...]",
Description: "Display the image object.", Description: "display the image object",
Flags: []cli.Flag{},
Action: func(context *cli.Context) error { Action: func(context *cli.Context) error {
dgst, err := digest.Parse(context.Args().First()) dgst, err := digest.Parse(context.Args().First())
if err != nil { if err != nil {
@ -63,11 +63,11 @@ var (
}, },
} }
ingestContentCommand = cli.Command{ ingestCommand = cli.Command{
Name: "ingest", Name: "ingest",
Usage: "accept content into the store", Usage: "accept content into the store",
ArgsUsage: "[flags] <key>", ArgsUsage: "[flags] <key>",
Description: `Ingest objects into the local content store.`, Description: "ingest objects into the local content store",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.Int64Flag{ cli.Int64Flag{
Name: "expected-size", Name: "expected-size",
@ -107,9 +107,9 @@ var (
activeIngestCommand = cli.Command{ activeIngestCommand = cli.Command{
Name: "active", Name: "active",
Usage: "display active transfers.", Usage: "display active transfers",
ArgsUsage: "[flags] [<regexp>]", ArgsUsage: "[flags] [<regexp>]",
Description: `Display the ongoing transfers.`, Description: "display the ongoing transfers",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.DurationFlag{ cli.DurationFlag{
Name: "timeout, t", Name: "timeout, t",
@ -147,12 +147,12 @@ var (
}, },
} }
listContentCommand = cli.Command{ listCommand = cli.Command{
Name: "list", Name: "list",
Aliases: []string{"ls"}, Aliases: []string{"ls"},
Usage: "list all blobs in the store.", Usage: "list all blobs in the store",
ArgsUsage: "[flags] [<filter>, ...]", ArgsUsage: "[flags]",
Description: `List blobs in the content store.`, Description: "list blobs in the content store",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.BoolFlag{ cli.BoolFlag{
Name: "quiet, q", Name: "quiet, q",
@ -206,12 +206,11 @@ var (
}, },
} }
labelContentCommand = cli.Command{ setLabelsCommand = cli.Command{
Name: "label", Name: "label",
Usage: "add labels to content", Usage: "add labels to content",
ArgsUsage: "[flags] <digest> [<label>=<value> ...]", ArgsUsage: "<digest> [<label>=<value> ...]",
Description: `Labels blobs in the content store`, Description: "labels blobs in the content store",
Flags: []cli.Flag{},
Action: func(context *cli.Context) error { Action: func(context *cli.Context) error {
object, labels := commands.ObjectWithLabelArgs(context) object, labels := commands.ObjectWithLabelArgs(context)
client, ctx, cancel, err := commands.NewClient(context) client, ctx, cancel, err := commands.NewClient(context)
@ -261,11 +260,11 @@ var (
}, },
} }
editContentCommand = cli.Command{ editCommand = cli.Command{
Name: "edit", Name: "edit",
Usage: "edit a blob and return a new digest.", Usage: "edit a blob and return a new digest",
ArgsUsage: "[flags] <digest>", ArgsUsage: "[flags] <digest>",
Description: `Edit a blob and return a new digest.`, Description: "edit a blob and return a new digest",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{
Name: "validate", Name: "validate",
@ -325,14 +324,13 @@ var (
}, },
} }
deleteContentCommand = cli.Command{ deleteCommand = cli.Command{
Name: "delete", Name: "delete",
Aliases: []string{"del", "remove", "rm"}, Aliases: []string{"del", "remove", "rm"},
Usage: "permanently delete one or more blobs.", Usage: "permanently delete one or more blobs",
ArgsUsage: "[flags] [<digest>, ...]", ArgsUsage: "[<digest>, ...]",
Description: `Delete one or more blobs permanently. Successfully deleted Description: `Delete one or more blobs permanently. Successfully deleted
blobs are printed to stdout.`, blobs are printed to stdout.`,
Flags: []cli.Flag{},
Action: func(context *cli.Context) error { Action: func(context *cli.Context) error {
var ( var (
args = []string(context.Args()) args = []string(context.Args())

View File

@ -7,6 +7,7 @@ import (
"os" "os"
"github.com/containerd/containerd/cmd/ctr/commands/containers" "github.com/containerd/containerd/cmd/ctr/commands/containers"
"github.com/containerd/containerd/cmd/ctr/commands/content"
"github.com/containerd/containerd/cmd/ctr/commands/images" "github.com/containerd/containerd/cmd/ctr/commands/images"
"github.com/containerd/containerd/cmd/ctr/commands/plugins" "github.com/containerd/containerd/cmd/ctr/commands/plugins"
versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version" versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version"
@ -72,7 +73,7 @@ containerd CLI
versionCmd.Command, versionCmd.Command,
applyCommand, applyCommand,
containers.Command, containers.Command,
contentCommand, content.Command,
eventsCommand, eventsCommand,
fetchCommand, fetchCommand,
fetchObjectCommand, fetchObjectCommand,