From 288fc854e02839bedca8fafd259643341ef100be Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 23 Feb 2026 15:35:05 -0500 Subject: [PATCH] doc/README.rst: add reStructuredText README Mainly for the benefit of Codeberg, but having something in plain text is nice too I guess. --- doc/README.rst | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 doc/README.rst diff --git a/doc/README.rst b/doc/README.rst new file mode 100644 index 0000000..6dc5fdf --- /dev/null +++ b/doc/README.rst @@ -0,0 +1,98 @@ +Overview +======== + +*This is only a brief introduction, see the man page for details.* + +Hath is a CLI utility for working with network blocks in CIDR +notation. There are a few things that one usually wants to do with +said blocks. Hath takes a list of CIDR blocks as input (via stdin), +and does one of the following, depending on the mode: + +regexed mode (default) + Create a regular expression matching the given blocks. +reduced mode + Combine consecutive small blocks into larger ones. +duped mode + List the blocks that are redundant or could be combined + into larger blocks. +diffed mode + Similar to reduced mode, but showing the changes in a diff-like + format. +listed mode + List the addresses in the blocks sequentially. + + +Usage +===== + +.. code-block:: console + + $ hath [regexed|reduced|duped|diffed|listed] [-hb] + + +Examples +======== + +.. code-block:: console + + $ echo "10.0.0.0/29 10.0.0.8/29" | hath + ((10).(0).(0).(15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0)) + +.. code-block:: console + + $ echo "10.0.0.0/24 10.0.1.0/24" | hath reduced + 10.0.0.0/23 + +.. code-block:: console + + $ echo "10.0.0.0/24 10.0.1.0/24" | hath duped + 10.0.0.0/24 + 10.0.1.0/24 + +.. code-block:: console + + $ echo "10.0.0.0/24 10.0.1.0/24" | hath diffed + -10.0.0.0/24 + -10.0.1.0/24 + +10.0.0.0/23 + +.. code-block:: console + + $ echo 192.168.0.240/29 | hath listed + 192.168.0.240 + 192.168.0.241 + 192.168.0.242 + 192.168.0.243 + 192.168.0.244 + 192.168.0.245 + 192.168.0.246 + 192.168.0.247 + + +Requirements +============ + +All dependencies are listed in the ``hath.cabal`` file. Just use cabal +to build it. + + +Installation +============ + +Cabal handles the build, so do whatever you normally do to install +cabal packages. If you just want to install it for your user, + +.. code-block:: console + + user $ runghc Setup.hs configure --user + user $ runghc Setup.hs build + user $ runghc Setup.hs install + +should do it. + + +Bugs +==== + +Email them to me at michael@orlitzky.com, or report them on `Codeberg +`_ -- 2.51.0