mirror of
https://github.com/containers/podman.git
synced 2025-12-09 23:27:09 +08:00
Add examples for Cobra
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com> First pass of entries for the Examples listed in the Cobra Help. Will add others in following PR's.
This commit is contained in:
@@ -33,7 +33,9 @@ var (
|
||||
commitCommand.GlobalFlags = MainGlobalOpts
|
||||
return commitCmd(&commitCommand)
|
||||
},
|
||||
Example: "CONTAINER [REPOSITORY[:TAG]]",
|
||||
Example: `podman commit -q --message "committing container to image" reverent_golick image-commited
|
||||
podman commit -q --author "firstName lastName" reverent_golick image-commited
|
||||
podman commit -q --pause=false containerID image-commited`,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -514,7 +514,7 @@ Aliases:
|
||||
{{.NameAndAliases}}{{end}}{{if .HasExample}}
|
||||
|
||||
Examples:
|
||||
{{.Example}}{{end}}{{if .HasAvailableSubCommands}}
|
||||
{{.Example}}{{end}}{{if .HasAvailableSubCommands}}
|
||||
|
||||
Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
|
||||
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
|
||||
|
||||
@@ -49,7 +49,9 @@ var (
|
||||
createCommand.GlobalFlags = MainGlobalOpts
|
||||
return createCmd(&createCommand)
|
||||
},
|
||||
Example: "IMAGE [COMMAND [ARG...]]",
|
||||
Example: `podman create alpine ls
|
||||
podman create --annotation HELLO=WORLD alpine ls
|
||||
podman create -t -i --name myctr alpine ls`,
|
||||
}
|
||||
|
||||
defaultEnvVariables = map[string]string{
|
||||
|
||||
@@ -41,7 +41,7 @@ var (
|
||||
imageExistsCommand.GlobalFlags = MainGlobalOpts
|
||||
return imageExistsCmd(&imageExistsCommand)
|
||||
},
|
||||
Example: "IMAGE-NAME",
|
||||
Example: `podman image exists imageID`,
|
||||
}
|
||||
|
||||
_containerExistsCommand = &cobra.Command{
|
||||
@@ -54,7 +54,7 @@ var (
|
||||
return containerExistsCmd(&containerExistsCommand)
|
||||
|
||||
},
|
||||
Example: "CONTAINER-NAME",
|
||||
Example: `podman container exists containerID`,
|
||||
}
|
||||
|
||||
_podExistsCommand = &cobra.Command{
|
||||
@@ -66,7 +66,7 @@ var (
|
||||
podExistsCommand.GlobalFlags = MainGlobalOpts
|
||||
return podExistsCmd(&podExistsCommand)
|
||||
},
|
||||
Example: "POD-NAME",
|
||||
Example: `podman pod exists podID`,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ var (
|
||||
infoCommand.GlobalFlags = MainGlobalOpts
|
||||
return infoCmd(&infoCommand)
|
||||
},
|
||||
Example: "",
|
||||
Example: `podman info`,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ var (
|
||||
inspectCommand.GlobalFlags = MainGlobalOpts
|
||||
return inspectCmd(&inspectCommand)
|
||||
},
|
||||
Example: "CONTAINER-OR-IMAGE [CONTAINER-OR-IMAGE]...",
|
||||
Example: `podman inspect alpine
|
||||
podman inspect --format "imageId: {{.Id}} size: {{.Size}}" alpine
|
||||
podman inspect --format "image: {{.ImageName}} driver: {{.Driver}}" myctr`,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -29,7 +29,9 @@ var (
|
||||
loginCommand.GlobalFlags = MainGlobalOpts
|
||||
return loginCmd(&loginCommand)
|
||||
},
|
||||
Example: "REGISTRY",
|
||||
Example: `podman login -u testuser -p testpassword localhost:5000
|
||||
podman login --authfile authdir/myauths.json quay.io
|
||||
podman login -u testuser -p testpassword localhost:5000`,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ var (
|
||||
podInspectCommand.GlobalFlags = MainGlobalOpts
|
||||
return podInspectCmd(&podInspectCommand)
|
||||
},
|
||||
Example: "[POD_NAME_OR_ID]",
|
||||
Example: `podman pod inspect podID`,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ If --force is specified, all containers will be stopped, then removed.
|
||||
podRmCommand.GlobalFlags = MainGlobalOpts
|
||||
return podRmCmd(&podRmCommand)
|
||||
},
|
||||
Example: "[POD ...]",
|
||||
Example: `podman pod rm mywebserverpod
|
||||
podman pod rm -f 860a4b23
|
||||
podman pod rm -f -a`,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user