Files
pmg/internal/ui/info.go
T
Sahilb315andCursor b1aa217011 fix: harden doctor PATH checks and attribute cloud events by OS user
Doctor now verifies every installed package manager against the shim
directory, and system-install validation only requires a safe parent
directory. Cloud sync records username/uid on invocation context for
multi-user hosts sharing one endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-13 23:12:02 +05:30

46 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package ui
import (
"fmt"
"sort"
)
// PrintInfoSection prints a formatted block of key-value information.
func PrintInfoSection(title string, entries map[string]string) {
fmt.Println()
fmt.Println(Colors.Cyan(title))
fmt.Println(Colors.Normal("--------------------"))
// Sort keys for consistent output
keys := make([]string, 0, len(entries))
for k := range entries {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
padded := fmt.Sprintf("%-25s", k)
fmt.Printf("%s: %s\n", Colors.Bold(padded), entries[k])
}
}
func PrintSetupInstallCmdInfo(aliasPath, shimBinDir, configPath string) {
fmt.Printf("%s %s\n", Colors.Green("✓"), "PMG installed successfully")
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Aliases: %s", aliasPath)))
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Shims: %s", shimBinDir)))
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Config: %s", configPath)))
fmt.Printf(" %s\n", Colors.Dim("Restart your terminal for changes to take effect"))
}
func PrintSetupSystemInstallCmdInfo(shimBinDir, configDir, profilePath string) {
fmt.Printf("%s %s\n", Colors.Green("✓"), "PMG system install completed")
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Shims: %s", shimBinDir)))
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Config: %s", configDir)))
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Profile: %s", profilePath)))
fmt.Printf(" %s\n", Colors.Dim("Per-user config files are now ignored."))
fmt.Printf("\n%s For Docker builds (RUN does not source profile.d), add:\n", Colors.Dim(""))
fmt.Printf(" %s\n", Colors.Bold(fmt.Sprintf(`ENV PATH="%s:$PATH"`, shimBinDir)))
fmt.Printf("%s Login shells pick up PATH from profile.d. After venv activate, use `pmg pip`.\n", Colors.Dim(""))
}