(args []string)
| 280 | } |
| 281 | |
| 282 | func (a *App) parsePortVisibilities(args []string) ([]portVisibility, error) { |
| 283 | ports := make([]portVisibility, 0, len(args)) |
| 284 | for _, a := range args { |
| 285 | fields := strings.Split(a, ":") |
| 286 | if len(fields) != 2 { |
| 287 | return nil, fmt.Errorf("invalid port visibility format for %q", a) |
| 288 | } |
| 289 | portStr, visibility := fields[0], fields[1] |
| 290 | portNumber, err := strconv.Atoi(portStr) |
| 291 | if err != nil { |
| 292 | return nil, fmt.Errorf("invalid port number: %w", err) |
| 293 | } |
| 294 | ports = append(ports, portVisibility{portNumber, visibility}) |
| 295 | } |
| 296 | return ports, nil |
| 297 | } |
| 298 | |
| 299 | // NewPortsForwardCmd returns a Cobra "ports forward" subcommand, which forwards a set of |
| 300 | // port pairs from the codespace to localhost. |
no test coverage detected