Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cmd/buildah/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ var (
Usage: "`operating system` of the target image",
},
cli.StringFlag{
Name: "user",
Name: "user, u",
Usage: "`user` to run containers based on image as",
},
cli.StringSliceFlag{
Name: "port",
Name: "port, p",
Usage: "`port` to expose when running containers based on image",
},
cli.StringSliceFlag{
Name: "env",
Name: "env, e",
Usage: "`environment variable` to set when running containers based on image",
},
cli.StringFlag{
Expand All @@ -56,19 +56,19 @@ var (
Usage: "`command` for containers based on image",
},
cli.StringSliceFlag{
Name: "volume",
Name: "volume, v",
Usage: "`volume` to create for containers based on image",
},
cli.StringFlag{
Name: "workingdir",
Usage: "working `directory` for containers based on image",
},
cli.StringSliceFlag{
Name: "label",
Name: "label, l",
Usage: "image configuration `label` e.g. label=value",
},
cli.StringSliceFlag{
Name: "annotation",
Name: "annotation, a",
Usage: "`annotation` e.g. annotation=value, for the target image",
},
}
Expand Down
21 changes: 17 additions & 4 deletions cmd/buildah/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ var (
// TODO implement
listFlags = []cli.Flag{
cli.BoolFlag{
Name: "quiet",
Usage: "omit column headings",
Name: "quiet, q",
Usage: "list only container image id's",
},
cli.BoolFlag{
Name: "noheading, n",
Usage: "do not print column headings",
},
}
listDescription = "Lists containers which appear to be " + buildah.Package + " working containers, their\n names and IDs, and the names and IDs of the images from which they were\n initialized"
Expand All @@ -38,18 +42,27 @@ func listCmd(c *cli.Context) error {
quiet = c.Bool("quiet")
}

noheading := false
if c.IsSet("noheading") {
noheading = c.Bool("noheading")
}

builders, err := openBuilders(store)
if err != nil {
return fmt.Errorf("error reading build containers: %v", err)
}
if len(builders) > 0 && !quiet {
if len(builders) > 0 && !noheading && !quiet {
fmt.Printf("%-64s %-64s %-10s %s\n", "CONTAINER ID", "IMAGE ID", "IMAGE NAME", "CONTAINER NAME")
}
for _, builder := range builders {
if builder.FromImage == "" {
builder.FromImage = buildah.BaseImageFakeName
}
fmt.Printf("%-64s %-64s %-10s %s\n", builder.ContainerID, builder.FromImageID, builder.FromImage, builder.Container)
if quiet {
fmt.Printf("%-64s\n", builder.ContainerID)
} else {
fmt.Printf("%-64s %-64s %-10s %s\n", builder.ContainerID, builder.FromImageID, builder.FromImage, builder.Container)
}
}

return nil
Expand Down