From cca931150e74baebcacbd0f21c6badaf17bb8c65 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 15 Jun 2019 10:46:06 -0700 Subject: add roun docs --- chip/roun | 24 ++++++++++++++++++++---- 1 file 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 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 . + +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', -- cgit v1.2.3