expects the output of `wsh version` which looks like `wsh v0.10.4` or "not-installed [os] [arch]" returns (up-to-date, semver, osArchStr, error) if not up to date, or error, version might be ""
(logCtx context.Context, wshVersionLine string)
| 313 | // returns (up-to-date, semver, osArchStr, error) |
| 314 | // if not up to date, or error, version might be "" |
| 315 | func IsWshVersionUpToDate(logCtx context.Context, wshVersionLine string) (bool, string, string, error) { |
| 316 | wshVersionLine = strings.TrimSpace(wshVersionLine) |
| 317 | if strings.HasPrefix(wshVersionLine, "not-installed") { |
| 318 | return false, "not-installed", strings.TrimSpace(strings.TrimPrefix(wshVersionLine, "not-installed")), nil |
| 319 | } |
| 320 | parts := strings.Fields(wshVersionLine) |
| 321 | if len(parts) != 2 { |
| 322 | return false, "", "", fmt.Errorf("unexpected version format: %s", wshVersionLine) |
| 323 | } |
| 324 | clientVersion := parts[1] |
| 325 | expectedVersion := fmt.Sprintf("v%s", wavebase.WaveVersion) |
| 326 | if semver.Compare(clientVersion, expectedVersion) < 0 { |
| 327 | return false, clientVersion, "", nil |
| 328 | } |
| 329 | return true, clientVersion, "", nil |
| 330 | } |
| 331 | |
| 332 | // for testing only -- trying to determine the env difference when attaching or not attaching a pty to an ssh session |
| 333 | func (conn *SSHConn) GetEnvironmentMaps(ctx context.Context) (map[string]string, map[string]string, error) { |
no outgoing calls
no test coverage detected