mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 14:13:48 +03:00
refactored add/remove packages to print warnings on present/absent packages
This commit is contained in:
parent
6ab9fb6f74
commit
06e146ccbe
1 changed files with 4 additions and 2 deletions
|
@ -61,7 +61,8 @@ func cmdAddPackage(fl Flags) (int, error) {
|
||||||
|
|
||||||
for _, arg := range fl.Args() {
|
for _, arg := range fl.Args() {
|
||||||
if _, ok := pluginPkgs[arg]; ok {
|
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{}{}
|
pluginPkgs[arg] = struct{}{}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +86,8 @@ func cmdRemovePackage(fl Flags) (int, error) {
|
||||||
for _, arg := range fl.Args() {
|
for _, arg := range fl.Args() {
|
||||||
if _, ok := pluginPkgs[arg]; !ok {
|
if _, ok := pluginPkgs[arg]; !ok {
|
||||||
// package does not exist
|
// 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)
|
delete(pluginPkgs, arg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue