mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
Add colorful outputs & remove md text (#13)
* fix: parsePackageInfo to handle pkg names with special character * Enhance pmg outputs by adding colors and removing markdown notions * Update pkg/wrapper/npm_base.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com> * Update npm_base.go Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com> * test: add tests for removeMarkdown * chore: remove duplicate code * refactor: convert TerminalColors to global var and split markdown utils --------- Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -10,14 +10,19 @@ import (
|
||||
)
|
||||
|
||||
func ConfirmInstallation(maliciousPkgs map[string]string) bool {
|
||||
fmt.Printf("\nWARNING: %d potentially malicious packages detected!\n", len(maliciousPkgs))
|
||||
fmt.Println("The following packages have been flagged:")
|
||||
|
||||
fmt.Printf("\n%s\n", colors.Red("⚠️ WARNING: %d potentially malicious packages detected!", len(maliciousPkgs)))
|
||||
fmt.Println(colors.Yellow("The following packages have been flagged:"))
|
||||
|
||||
for name, reason := range maliciousPkgs {
|
||||
fmt.Printf("- %s: %s\n", name, reason)
|
||||
fmt.Printf("%s %s: %s\n",
|
||||
colors.Cyan("•"), // bullet point
|
||||
colors.Yellow(name),
|
||||
removeMarkdown(reason),
|
||||
)
|
||||
}
|
||||
|
||||
fmt.Print("\nDo you want to continue with installation? (y/N): ")
|
||||
fmt.Print("\n", colors.Green("Do you want to continue with installation? (y/N): "))
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
response, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user