IntersectMBO / bech32

Haskell implementation of the Bech32 address format (BIP 0173).
Apache License 2.0
44 stars 13 forks source link

Add version switch to CLI #30

Closed newhoggy closed 3 years ago

newhoggy commented 3 years ago

Examples:

$ bech32 --help
Usage: bech32 [PREFIX]
  Convert to and from bech32 strings. Data are read from standard input.

Available options:
  -h,--help                Show this help text
  PREFIX                   An optional human-readable prefix (e.g. 'addr').
                             - When provided, the input text is decoded from various encoding formats and re-encoded to bech32 using the given prefix.
                             - When omitted, the input text is decoded from bech32 to base16.
  -v,--version             output version information and exit

Supported encoding formats: Base16, Bech32 & Base58.

Examples:
  To Bech32:
    $ bech32 base16_ <<< 706174617465
    base16_1wpshgct5v5r5mxh0

    $ bech32 base58_ <<< Ae2tdPwUPEYy
    base58_1p58rejhd9592uusa8pzj2

    $ bech32 new_prefix <<< old_prefix1wpshgcg2s33x3
    new_prefix1wpshgcgeak9mv

  From Bech32:
    $ bech32 <<< base16_1wpshgct5v5r5mxh0
    706174617465
$ bech32 --version
1.1.0
$ bech32 -v
1.1.0
$ bech32 base16_ <<< 706174617465
base16_1wpshgct5v5r5mxh0
newhoggy commented 3 years ago

This addresses https://github.com/input-output-hk/bech32/issues/23

newhoggy commented 3 years ago

I also saw there is a slightly nicer way to do the version option, if you're interesting in trying that

Maybe later 😁