Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PortForwardCmd = &cobra.Command{ Use: "forward [PORT]", Short: "Forward a port from a project to your local machine", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { port, err := strconv.Atoi(args[0]) if err != nil { log.Fatal(err) } if len(args) > 1 { workspace, err := server.GetWorkspace(args[1]) if err != nil { log.Fatal(err) } workspaceId = *workspace.Id } if len(args) == 3 { projectName = args[2] } else { projectName, err = server.GetFirstWorkspaceProjectName(workspaceId, projectName, nil) if err != nil { log.Fatal(err) } } hostPort, errChan := ports.ForwardPort(workspaceId, projectName, uint16(port)) if hostPort == nil { if err = <-errChan; err != nil { log.Fatal(err) } } else { if *hostPort != uint16(port) { view_util.RenderInfoMessage(fmt.Sprintf("Port %d already in use.", port)) } view_util.RenderInfoMessage(fmt.Sprintf("Port available at http://localhost:%d\n", *hostPort)) } if publicPreview { go func() { errChan <- forwardPublicPort(workspaceId, projectName, *hostPort, uint16(port)) }() } for { err := <-errChan if err != nil { log.Debug(err) } } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.