MCPcopy Index your code
hub / github.com/cli/cli / newPortsForwardCmd

Function newPortsForwardCmd

pkg/cmd/codespace/ports.go:301–310  ·  view source on GitHub ↗

NewPortsForwardCmd returns a Cobra "ports forward" subcommand, which forwards a set of port pairs from the codespace to localhost.

(app *App, selector *CodespaceSelector)

Source from the content-addressed store, hash-verified

299// NewPortsForwardCmd returns a Cobra "ports forward" subcommand, which forwards a set of
300// port pairs from the codespace to localhost.
301func newPortsForwardCmd(app *App, selector *CodespaceSelector) *cobra.Command {
302 return &cobra.Command{
303 Use: "forward <remote-port>:<local-port>...",
304 Short: "Forward ports",
305 Args: cobra.MinimumNArgs(1),
306 RunE: func(cmd *cobra.Command, args []string) error {
307 return app.ForwardPorts(cmd.Context(), selector, args)
308 },
309 }
310}
311
312func (a *App) ForwardPorts(ctx context.Context, selector *CodespaceSelector, ports []string) (err error) {
313 portPairs, err := getPortPairs(ports)

Callers 1

newPortsCmdFunction · 0.85

Calls 1

ForwardPortsMethod · 0.80

Tested by

no test coverage detected