From 20c3f80e7dfd9e453d757199beb2137c09a9f536 Mon Sep 17 00:00:00 2001
From: Shulhan <ms@kilabit.info>
Date: Fri, 13 May 2022 21:14:29 +0700
Subject: cmd/resolver: implement command to delete record on hosts file

The command has the following signature,

      resolver hosts.d rr delete <name> <domain>

Given the hosts name "hosts" and domain "my.hosts" it will delete
all records that have domain name "my.hosts" inside the file.
---
 _doc/resolver.adoc | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

(limited to '_doc/resolver.adoc')

diff --git a/_doc/resolver.adoc b/_doc/resolver.adoc
index f0d40de..9951ad5 100644
--- a/_doc/resolver.adoc
+++ b/_doc/resolver.adoc
@@ -181,6 +181,13 @@ instead of replaced.
 --
 
 
+hosts.d rr delete <name> <domain>::
++
+--
+Delete record from hosts file "name" by domain name.
+--
+
+
 == EXIT STATUS
 
 Upon exit and success +resolver+ will return 0, or 1 otherwise.
@@ -188,6 +195,8 @@ Upon exit and success +resolver+ will return 0, or 1 otherwise.
 
 == EXAMPLES
 
+===  QUERY EXAMPLES
+
 Query the IPv4 address for kilabit.info,
 
 	$ resolver query kilabit.info
@@ -215,6 +224,9 @@ Inspect the rescached's caches on server at http://127.0.0.1:5380,
 
 	$ resolver -server=http://127.0.0.1:5380 caches
 
+
+===  MANAGING CACHES
+
 Search caches that contains "bit" on the domain name,
 
 	$ resolver caches search bit
@@ -227,6 +239,9 @@ Remove all caches in the server,
 
 	$ resolver caches remove all
 
+
+===  MANAGING ENVIRONMENT
+
 Fetch and print current server environment,
 
 	$ resolver env
@@ -239,6 +254,9 @@ Update the server environment by reading JSON from standard input,
 
 	$ cat /tmp/env.json | resolver env update -
 
+
+===  MANAGING HOSTS.D
+
 Create new hosts file named "myhosts" inside the hosts.d directory,
 
 	$ resolver hosts.d create myhosts
@@ -269,6 +287,8 @@ Get the content of hosts file named "myhosts" inside the hosts.d directory,
 	  }
 	]
 
+===  MANAGING RECORD ON HOSTS.D
+
 Add new record "127.0.0.1 my.hosts" to hosts file named "hosts",
 
 	$ resolver hosts.d rr add hosts my.hosts 127.0.0.1
@@ -280,6 +300,16 @@ Add new record "127.0.0.1 my.hosts" to hosts file named "hosts",
 	  "TTL": 604800
 	}
 
+Delete record "my.hosts" from hosts file "hosts",
+
+	$ resolver hosts.d rr delete hosts my.hosts
+	{
+	  "Value": "127.0.0.1",
+	  "Name": "my.hosts",
+	  "Type": 1,
+	  "Class": 1,
+	  "TTL": 604800
+	}
 
 == AUTHOR
 
-- 
cgit v1.3

