aboutsummaryrefslogtreecommitdiff
path: root/cmd/resolver/main.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-04-16 01:06:38 +0700
committerShulhan <ms@kilabit.info>2022-04-16 18:32:36 +0700
commitdfc441b32458d204dae6498867f08e7da483c815 (patch)
tree5348dbd28424e24719fdc582f8881551c390f3d7 /cmd/resolver/main.go
parentf9338965943247d124174c79392033518dc06a5b (diff)
downloadrescached-dfc441b32458d204dae6498867f08e7da483c815.tar.xz
cmd/resolver: implement command to fetch and print server environment
The "env" command fetch the current server environment and print as ini format to stdout.
Diffstat (limited to 'cmd/resolver/main.go')
-rw-r--r--cmd/resolver/main.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/cmd/resolver/main.go b/cmd/resolver/main.go
index 90a1686..90fcc68 100644
--- a/cmd/resolver/main.go
+++ b/cmd/resolver/main.go
@@ -16,6 +16,7 @@ import (
// List of valid commands.
const (
cmdCaches = "caches"
+ cmdEnv = "env"
cmdQuery = "query"
subCmdSearch = "search"
@@ -83,6 +84,9 @@ func main() {
os.Exit(2)
}
+ case cmdEnv:
+ rsol.doCmdEnv()
+
case cmdQuery:
args = args[1:]
if len(args) == 0 {
@@ -165,6 +169,11 @@ caches remove <string>
Remove the domain name from rescached caches.
If the parameter is "all", it will remove all caches.
+env
+
+ Fetch the current server environment and print it as JSON format to
+ stdout.
+
== Examples
@@ -197,5 +206,17 @@ Inspect the rescached's caches on server at http://127.0.0.1:5380,
Search caches that contains "bit" on the domain name,
- $ resolver -server=http://127.0.0.1:5380 caches search bit`)
+ $ resolver caches search bit
+
+Remove caches that contains domain name "kilabit.info",
+
+ $ resolver caches remove kilabit.info
+
+Remove all caches in the server,
+
+ $ resolver caches remove all
+
+Fetch and print current server environment,
+
+ $ resolver env`)
}