Skip to content

Commit

Permalink
integrating the portforward command in odo cli
Browse files Browse the repository at this point in the history
  • Loading branch information
girishramnani committed Sep 12, 2019
1 parent 2408294 commit 390dbb5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions pkg/odo/cli/experimental/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package debug

import (
"github.com/openshift/odo/pkg/odo/util"

"github.com/spf13/cobra"
)

Expand All @@ -12,14 +11,17 @@ const RecommendedCommandName = "debug"
var DebugLongDesc = `Debugging related functions`

func NewCmdDebug(name, fullName string) *cobra.Command {

portforwardCmd := NewCmdPortForward(portforwardCommandName, util.GetFullName(fullName, portforwardCommandName))

debugCmd := &cobra.Command{
Use: name,
Short: "Debug commands",
Long: DebugLongDesc,
Aliases: []string{"e"},
Aliases: []string{"d"},
}

debugCmd.SetUsageTemplate(util.CmdUsageTemplate)
debugCmd.Annotations = map[string]string{"command": "main"}
debugCmd.AddCommand(portforwardCmd)
return debugCmd
}
3 changes: 2 additions & 1 deletion pkg/odo/cli/experimental/debug/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ var (
const (
// Amount of time to wait until at least one pod is running
defaultPodPortForwardWaitTimeout = 60 * time.Second
portforwardCommandName = "port-forward"
)

func NewPortForwardOptions() *PortForwardOptions {
Expand Down Expand Up @@ -153,7 +154,7 @@ func NewCmdPortForward(name, fullName string) *cobra.Command {

opts := NewPortForwardOptions()
cmd := &cobra.Command{
Use: name + "port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]",
Use: name + " [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]",
Short: "Forward one or more local ports to a pod",
Long: portforwardLong,
Example: portforwardExample,
Expand Down
2 changes: 1 addition & 1 deletion pkg/odo/cli/experimental/experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func NewCmdExperimental(name, fullName string) *cobra.Command {
Aliases: []string{"e"},
}

experimentalCmd.AddCommand(debugCmd)
experimentalCmd.SetUsageTemplate(util.CmdUsageTemplate)
experimentalCmd.AddCommand(debugCmd)
experimentalCmd.Annotations = map[string]string{"command": "main"}
return experimentalCmd
}

0 comments on commit 390dbb5

Please sign in to comment.