summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-06-15 10:46:06 -0700
committerBen Sima <ben@bsima.me>2019-06-15 10:46:06 -0700
commitcca931150e74baebcacbd0f21c6badaf17bb8c65 (patch)
treeb37b9e0241544c09990bf6c1e919f11157cc352d /chip
parentc95b9f739bf4e4d918853cd0c67e3397bd9c0474 (diff)
add roun docs
Diffstat (limited to 'chip')
-rwxr-xr-xchip/roun24
1 files changed, 20 insertions, 4 deletions
diff --git a/chip/roun b/chip/roun
index 19a7438..fb1624a 100755
--- a/chip/roun
+++ b/chip/roun
@@ -1,9 +1,24 @@
#!/usr/bin/env python3
-#
-# adapted from proquints <https://arxiv.org/html/0901.4016>
import argparse
+DESC = """roun is a program that takes numbers and turns them into human-readable
+names, and vice versa.
+
+A 'roun' is the human-readable name. For example:
+
+ roun = hidor-kahih
+ ip = 68.107.97.20
+ hex = 0x446b6114
+ int = 1147887892
+
+The names are inspired by proquints <https://arxiv.org/html/0901.4016>.
+
+Currently the algorithm is the same, but I would like to modify the algorithm at
+some point to be less odd than what proquints currently is. When I get time.
+"""
+
+
def _char_list_to_dict(char_list):
return {c: k for (c, k) in zip(char_list, range(len(char_list)))}
@@ -157,8 +172,9 @@ def convert(str_val, target=None):
raise ValueError('Unrecognized input format: {}'.format(str_val))
if __name__ == '__main__':
- desc = 'Convert between [integer, hexadecimal, IPv4 address] <-> roun representations. '
- parser = argparse.ArgumentParser(description=desc)
+ parser = argparse.ArgumentParser(
+ description=DESC,
+ formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-n', '--uint', action='store_true',
help='convert from roun to 32-bit integer', required=False)
parser.add_argument('-x', '--hex', action='store_true',