diff options
-rwxr-xr-x | chip/roun | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -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', |