Skip to content

Commit

Permalink
refactored add/remove packages to print warnings on present/absent pa…
Browse files Browse the repository at this point in the history
…ckages
  • Loading branch information
armadi1809 committed Sep 18, 2024
1 parent 6ab9fb6 commit 06e146c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/packagesfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{}
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 06e146c

Please sign in to comment.