diff options
-rw-r--r-- | cmd/kpod/formats/formats.go | 2 | ||||
-rw-r--r-- | cmd/kpod/history.go | 12 | ||||
-rw-r--r-- | cmd/kpod/images.go | 16 | ||||
-rw-r--r-- | cmd/kpod/ps.go | 17 | ||||
-rw-r--r-- | transfer.md | 30 |
5 files changed, 55 insertions, 22 deletions
diff --git a/cmd/kpod/formats/formats.go b/cmd/kpod/formats/formats.go index 6e5dd2425..4b6527b30 100644 --- a/cmd/kpod/formats/formats.go +++ b/cmd/kpod/formats/formats.go @@ -1,6 +1,7 @@ package formats import ( + "bytes" "encoding/json" "fmt" "os" @@ -8,7 +9,6 @@ import ( "text/tabwriter" "text/template" - "bytes" "github.com/ghodss/yaml" "github.com/pkg/errors" ) diff --git a/cmd/kpod/history.go b/cmd/kpod/history.go index 211a843d0..20422b7c3 100644 --- a/cmd/kpod/history.go +++ b/cmd/kpod/history.go @@ -92,10 +92,7 @@ func historyCmd(c *cli.Context) error { } defer runtime.Shutdown(false) - format := genHistoryFormat(c.Bool("quiet")) - if c.IsSet("format") { - format = c.String("format") - } + format := genHistoryFormat(c.String("format"), c.Bool("quiet")) args := c.Args() if len(args) == 0 { @@ -121,7 +118,12 @@ func historyCmd(c *cli.Context) error { return generateHistoryOutput(history, layers, imageID, opts) } -func genHistoryFormat(quiet bool) (format string) { +func genHistoryFormat(format string, quiet bool) string { + if format != "" { + // "\t" from the command line is not being recognized as a tab + // replacing the string "\t" to a tab character if the user passes in "\t" + return strings.Replace(format, `\t`, "\t", -1) + } if quiet { return formats.IDString } diff --git a/cmd/kpod/images.go b/cmd/kpod/images.go index 1cf69c96d..2b1003ebd 100644 --- a/cmd/kpod/images.go +++ b/cmd/kpod/images.go @@ -92,12 +92,7 @@ func imagesCmd(c *cli.Context) error { } defer runtime.Shutdown(false) - var format string - if c.IsSet("format") { - format = c.String("format") - } else { - format = genImagesFormat(c.Bool("quiet"), c.Bool("noheading"), c.Bool("digests")) - } + format := genImagesFormat(c.String("format"), c.Bool("quiet"), c.Bool("noheading"), c.Bool("digests")) opts := imagesOptions{ quiet: c.Bool("quiet"), @@ -136,7 +131,12 @@ func imagesCmd(c *cli.Context) error { return generateImagesOutput(runtime, images, opts) } -func genImagesFormat(quiet, noHeading, digests bool) (format string) { +func genImagesFormat(format string, quiet, noHeading, digests bool) string { + if format != "" { + // "\t" from the command line is not being recognized as a tab + // replacing the string "\t" to a tab character if the user passes in "\t" + return strings.Replace(format, `\t`, "\t", -1) + } if quiet { return formats.IDString } @@ -148,7 +148,7 @@ func genImagesFormat(quiet, noHeading, digests bool) (format string) { format += "{{.Digest}}\t" } format += "{{.ID}}\t{{.Created}}\t{{.Size}}\t" - return + return format } // imagesToGeneric creates an empty array of interfaces for output diff --git a/cmd/kpod/ps.go b/cmd/kpod/ps.go index d3b38cbd6..36ce18515 100644 --- a/cmd/kpod/ps.go +++ b/cmd/kpod/ps.go @@ -160,10 +160,7 @@ func psCmd(c *cli.Context) error { return errors.Errorf("too many arguments, ps takes no arguments") } - format := genPsFormat(c.Bool("quiet"), c.Bool("size"), c.Bool("namespace")) - if c.IsSet("format") { - format = c.String("format") - } + format := genPsFormat(c.String("format"), c.Bool("quiet"), c.Bool("size"), c.Bool("namespace")) opts := psOptions{ all: c.Bool("all"), @@ -302,19 +299,23 @@ func generateContainerFilterFuncs(filter, filterValue string, runtime *libpod.Ru } // generate the template based on conditions given -func genPsFormat(quiet, size, namespace bool) (format string) { +func genPsFormat(format string, quiet, size, namespace bool) string { + if format != "" { + // "\t" from the command line is not being recognized as a tab + // replacing the string "\t" to a tab character if the user passes in "\t" + return strings.Replace(format, `\t`, "\t", -1) + } if quiet { return formats.IDString } if namespace { - format = "table {{.ID}}\t{{.Names}}\t{{.PID}}\t{{.Cgroup}}\t{{.IPC}}\t{{.MNT}}\t{{.NET}}\t{{.PIDNS}}\t{{.User}}\t{{.UTS}}\t" - return + return "table {{.ID}}\t{{.Names}}\t{{.PID}}\t{{.Cgroup}}\t{{.IPC}}\t{{.MNT}}\t{{.NET}}\t{{.PIDNS}}\t{{.User}}\t{{.UTS}}\t" } format = "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\t" if size { format += "{{.Size}}\t" } - return + return format } func psToGeneric(templParams []psTemplateParams, JSONParams []psJSONParams) (genericParams []interface{}) { diff --git a/transfer.md b/transfer.md index 4d5ffd59d..5c1fbc17c 100644 --- a/transfer.md +++ b/transfer.md @@ -39,6 +39,7 @@ There are other equivalents for these tools | :---: | :---: | | `docker attach` | [`kpod exec`](./docs/kpod-attach.1.md) ***| | `docker build` | [`buildah bud`](https://github.com/projectatomic/buildah/blob/master/docs/buildah-bud.md) | +| `docker commit` | [`buildah commit`](https://github.com/projectatomic/buildah/blob/master/docs/buildah-commit.md) | | `docker cp` | [`kpod mount`](./docs/kpod-cp.1.md) **** | | `docker create` | [`kpod create`](./docs/kpod-create.1.md) | | `docker diff` | [`kpod diff`](./docs/kpod-diff.1.md) | @@ -65,3 +66,32 @@ There are other equivalents for these tools *** Use `kpod exec` to enter a container and `kpod logs` to view the output of pid 1 of a container. **** Use mount to take advantage of the entire linux tool chain rather then just cp. Read [`here`](./docs/kpod-cp.1.md) for more information. + +## Missing commands in kpod + +Those Docker commands currently do not have equivalents in `kpod`: + + * `docker container` + * `docker events` + * `docker image` + * `docker network` + * `docker node` + * `docker plugin` + * `docker port` + * `docker rename` + * `docker restart` + * `docker search` + * `docker secret` + * `docker service` + * `docker stack` + * `docker swarm` + * `docker system` + * `docker top` + * `docker volume` + +## Missing commands in Docker + +The following kpod commands do not have a Docker equivalent: + +* [`kpod mount`](./docs/kpod-mount.1.md) +* [`kpod umount`](./docs/kpod-umount.1.md) |