From 06e146ccbe405d6c4d3fbdfd77f0c95d954cf958 Mon Sep 17 00:00:00 2001 From: armadi1809 Date: Tue, 17 Sep 2024 21:24:51 -0500 Subject: [PATCH] refactored add/remove packages to print warnings on present/absent packages --- cmd/packagesfuncs.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/packagesfuncs.go b/cmd/packagesfuncs.go index 0784f7ee68e..7e01e802810 100644 --- a/cmd/packagesfuncs.go +++ b/cmd/packagesfuncs.go @@ -61,7 +61,8 @@ func cmdAddPackage(fl Flags) (int, error) { for _, arg := range fl.Args() { if _, ok := pluginPkgs[arg]; ok { - return caddy.ExitCodeFailedStartup, fmt.Errorf("package is already added") + fmt.Printf("[WARNING] package %s is already added", arg) + continue } pluginPkgs[arg] = struct{}{} } @@ -85,7 +86,8 @@ func cmdRemovePackage(fl Flags) (int, error) { for _, arg := range fl.Args() { if _, ok := pluginPkgs[arg]; !ok { // package does not exist - return caddy.ExitCodeFailedStartup, fmt.Errorf("package is not added") + fmt.Printf("[WARNING] package %s is not added", arg) + continue } delete(pluginPkgs, arg) }