summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-19 10:43:13 +0100
committerGitHub <noreply@github.com>2021-11-19 10:43:13 +0100
commitc603318b43187bd5e1642246d84da2bcd5c68aae (patch)
tree09c2ef317c10675ee038f9489a77c9def547459c /cmd
parent63196c26a96652a824ff2d3fe68ac467060a0001 (diff)
parent22ef7b6208fbe958594577bbec37ddca4f1dff82 (diff)
downloadpodman-c603318b43187bd5e1642246d84da2bcd5c68aae.tar.gz
podman-c603318b43187bd5e1642246d84da2bcd5c68aae.tar.bz2
podman-c603318b43187bd5e1642246d84da2bcd5c68aae.zip
Merge pull request #12356 from Luap99/pod-logs
fix duplicated logs command
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/pods/logs.go31
1 files changed, 6 insertions, 25 deletions
diff --git a/cmd/podman/pods/logs.go b/cmd/podman/pods/logs.go
index fe5205669..a79c0430f 100644
--- a/cmd/podman/pods/logs.go
+++ b/cmd/podman/pods/logs.go
@@ -27,11 +27,11 @@ type logsOptionsWrapper struct {
var (
logsPodOptions logsOptionsWrapper
logsPodDescription = `Displays logs for pod with one or more containers.`
- logsPodCommand = &cobra.Command{
+ podLogsCommand = &cobra.Command{
Use: "logs [options] POD",
Short: "Fetch logs for pod with one or more containers",
Long: logsPodDescription,
- // We dont want users to invoke latest and pod togather
+ // We dont want users to invoke latest and pod together
Args: func(cmd *cobra.Command, args []string) error {
switch {
case registry.IsRemote() && logsPodOptions.Latest:
@@ -53,35 +53,16 @@ var (
podman pod logs --follow=true --since 10m podID
podman pod logs mywebserver`,
}
-
- containerLogsCommand = &cobra.Command{
- Use: logsPodCommand.Use,
- Short: logsPodCommand.Short,
- Long: logsPodCommand.Long,
- Args: logsPodCommand.Args,
- RunE: logsPodCommand.RunE,
- ValidArgsFunction: logsPodCommand.ValidArgsFunction,
- Example: `podman pod logs podId
- podman pod logs -c ctrname podName
- podman pod logs --tail 2 mywebserver
- podman pod logs --follow=true --since 10m podID`,
- }
)
func init() {
+ // pod logs
registry.Commands = append(registry.Commands, registry.CliCommand{
- Command: logsPodCommand,
- })
- logsFlags(logsPodCommand)
- validate.AddLatestFlag(logsPodCommand, &logsPodOptions.Latest)
-
- // container logs
- registry.Commands = append(registry.Commands, registry.CliCommand{
- Command: containerLogsCommand,
+ Command: podLogsCommand,
Parent: podCmd,
})
- logsFlags(containerLogsCommand)
- validate.AddLatestFlag(containerLogsCommand, &logsPodOptions.Latest)
+ logsFlags(podLogsCommand)
+ validate.AddLatestFlag(podLogsCommand, &logsPodOptions.Latest)
}
func logsFlags(cmd *cobra.Command) {