aboutsummaryrefslogtreecommitdiff
path: root/cmd/resolver/main.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-04-24 11:19:38 +0700
committerShulhan <ms@kilabit.info>2022-04-24 11:24:54 +0700
commitbd144b51b440aaf07de8c775a96d6dafcdcad6bd (patch)
treef4cf2b5ccff2e04c13e4a92670824ca8ca55fef1 /cmd/resolver/main.go
parentb6ae7b07309af5d0e4fd6b6d2615184054f98dd7 (diff)
downloadrescached-bd144b51b440aaf07de8c775a96d6dafcdcad6bd.tar.xz
cmd/resolver: simplify method to handle block.d command
Instead of splitting them into three methods, merge them into single method.
Diffstat (limited to 'cmd/resolver/main.go')
-rw-r--r--cmd/resolver/main.go39
1 files changed, 1 insertions, 38 deletions
diff --git a/cmd/resolver/main.go b/cmd/resolver/main.go
index 9ffc60b..c4b9367 100644
--- a/cmd/resolver/main.go
+++ b/cmd/resolver/main.go
@@ -66,44 +66,7 @@ func main() {
switch rsol.cmd {
case cmdBlockd:
- args = args[1:]
- if len(args) == 0 {
- log.Fatalf("resolver: %s: missing sub command", cmdBlockd)
- }
-
- subCmd = strings.ToLower(args[0])
-
- switch subCmd {
- case subCmdDisable:
- args = args[1:]
- if len(args) == 0 {
- log.Fatalf("resolver: %s %s: missing argument", rsol.cmd, subCmd)
- }
- err = rsol.blockdDisable(args[0])
- if err != nil {
- log.Fatalf("resolver: %s %s: %s", rsol.cmd, subCmd, err)
- }
-
- case subCmdEnable:
- args = args[1:]
- if len(args) == 0 {
- log.Fatalf("resolver: %s %s: missing argument", rsol.cmd, subCmd)
- }
- err = rsol.blockdEnable(args[0])
- if err != nil {
- log.Fatalf("resolver: %s %s: %s", rsol.cmd, subCmd, err)
- }
-
- case subCmdUpdate:
- args = args[1:]
- if len(args) == 0 {
- log.Fatalf("resolver: %s %s: missing argument", rsol.cmd, subCmd)
- }
- err = rsol.blockdUpdate(args[0])
- if err != nil {
- log.Fatalf("resolver: %s %s: %s", rsol.cmd, subCmd, err)
- }
- }
+ rsol.doCmdBlockd(args[1:])
case cmdCaches:
args = args[1:]