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:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/safedep/dry/log"
|
||||
"github.com/safedep/pmg/internal/ui"
|
||||
"github.com/safedep/pmg/pkg/analyser"
|
||||
@@ -28,8 +29,8 @@ func NewPackageManagerWrapper(registryType registry.RegistryType) *PackageManage
|
||||
|
||||
func (pmw *PackageManagerWrapper) Wrap() error {
|
||||
ui.StartProgressWriter()
|
||||
|
||||
progressTracker := ui.TrackProgress(fmt.Sprintf("Scanning %s ", pmw.PackageName), 5)
|
||||
var DefaultProgressTotal = 5
|
||||
progressTracker := ui.TrackProgress(fmt.Sprintf("Scanning %s ", pmw.PackageName), DefaultProgressTotal)
|
||||
if pmw.PackageName == "" {
|
||||
return fmt.Errorf("package name cannot be empty")
|
||||
}
|
||||
@@ -133,7 +134,8 @@ func (pmw *PackageManagerWrapper) analyzeDependencies(ctx context.Context, deps
|
||||
log.Infof("Installation canceled due to security concerns")
|
||||
return fmt.Errorf("installation canceled")
|
||||
}
|
||||
log.Warnf("Continuing installation despite security warnings...")
|
||||
yellow := color.New(color.FgYellow, color.Bold).SprintfFunc()
|
||||
log.Warnf(yellow("Continuing installation despite security warnings..."))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user