bech32 1.1.0 → 1.1.1
raw patch · 3 files changed
+67/−34 lines, 3 filesdep ~basenew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Codec.Binary.Bech32.Internal: instance GHC.Arr.Ix Codec.Binary.Bech32.Internal.Word5
+ Codec.Binary.Bech32.Internal: instance GHC.Ix.Ix Codec.Binary.Bech32.Internal.Word5
Files
- ChangeLog.md +14/−3
- app/Main.hs +32/−10
- bech32.cabal +21/−21
ChangeLog.md view
@@ -2,12 +2,23 @@ <!-- This ChangeLog follows a format specified by: https://keepachangelog.com/en/1.0.0/ --> +## [1.1.1] - 2021-06-11++### Added++- Added `--version` switch for the `bech32` command.++### Changed++- Upgraded CI to build with Cabal 3.4.0.0 and GHC 8.10.4.+- Update version constraints for GHC 9.0.1.+ ## [1.1.0] - 2020-07-08 -### Added +### Added - Added `bech32` command-line for easy conversions in the console.- + ```console Usage: bech32 [PREFIX] Convert to and from bech32 strings. Data are read from standard input.@@ -60,6 +71,6 @@ ## [1.0.0] - 2019-09-27 -### Added +### Added - Initial release pulled from https://github.com/input-output-hk/cardano-wallet
app/Main.hs view
@@ -11,7 +11,7 @@ import Control.Arrow ( left, right ) import Control.Monad- ( guard )+ ( guard, void ) import Data.ByteArray.Encoding ( convertFromBase, convertToBase ) import Data.ByteString.Base58@@ -22,25 +22,34 @@ ( maybeToEither ) import Data.Maybe ( fromJust )+import Data.Version+ ( showVersion ) import Options.Applicative ( Parser , ParserInfo , argument , customExecParser , eitherReader+ , flag , footerDoc+ , help , helpDoc , helper+ , hidden , info+ , long , metavar , optional , prefs , progDesc+ , short , showHelpOnEmpty , (<|>) ) import Options.Applicative.Help.Pretty ( bold, hsep, indent, text, underline, vsep )+import Paths_bech32+ ( version ) import System.IO ( BufferMode (..), Handle, hSetBuffering, stderr, stdin, stdout ) @@ -54,9 +63,12 @@ main :: IO () main = setup >> parse >>= run -newtype Cmd = Cmd- { prefix :: Maybe HumanReadablePart- } deriving (Show)+data Cmd+ = RunCmd+ { prefix :: Maybe HumanReadablePart+ }+ | VersionCmd+ deriving (Show) -- | Enable ANSI colors on Windows and correct output buffering setup :: IO ()@@ -100,8 +112,16 @@ ] cmd :: Parser Cmd- cmd = Cmd <$> optional hrpArgument+ cmd = (RunCmd <$> optional hrpArgument) <|> (VersionCmd <$ versionFlag) +versionFlag :: Parser ()+versionFlag = void . flag False True $ mconcat+ [ long "version"+ , short 'v'+ , help "output version information and exit"+ , hidden+ ]+ -- | Parse a 'HumanReadablePart' as an argument. hrpArgument :: Parser HumanReadablePart hrpArgument = argument (eitherReader reader) $ mconcat@@ -121,11 +141,13 @@ -- | Run a Command in IO run :: Cmd -> IO ()-run Cmd{prefix} = do- source <- T.decodeUtf8 . B8.filter (/= '\n') <$> B8.hGetContents stdin- case prefix of- Nothing -> runDecode source- Just hrp -> runEncode hrp source+run cmd = case cmd of+ VersionCmd -> putStrLn $ showVersion version+ RunCmd {prefix} -> do+ source <- T.decodeUtf8 . B8.filter (/= '\n') <$> B8.hGetContents stdin+ case prefix of+ Nothing -> runDecode source+ Just hrp -> runEncode hrp source where runDecode source = case Bech32.decodeLenient source of
bech32.cabal view
@@ -1,5 +1,5 @@ name: bech32-version: 1.1.0+version: 1.1.1 synopsis: Implementation of the Bech32 cryptocurrency address format (BIP 0173). description: Implementation of the Bech32 cryptocurrency address format documented in the BIP (Bitcoin Improvement Proposal) 0173.@@ -19,15 +19,15 @@ type: git location: https://github.com/input-output-hk/bech32.git -flag werror- description: Enable `-Werror`- default: False- manual: True- flag release- description: Compile executables for a release.+ description: Strict compiler warning checks.+ default: False manual: True++flag static+ description: Try to build a static executable. default: False+ manual: True library default-language:@@ -36,15 +36,12 @@ NoImplicitPrelude OverloadedStrings ghc-options:- -Wall- -Wcompat- -fwarn-redundant-constraints- if (flag(werror))- ghc-options:- -Werror+ -Wall -Wcompat -fwarn-redundant-constraints+ if flag(release)+ ghc-options: -Werror build-depends: array- , base >= 4.11.1.0 && < 4.15+ , base >= 4.11.1.0 && <5 , bytestring , containers , extra@@ -61,9 +58,8 @@ Paths_bech32 hs-source-dirs: app- ghc-options: -Wall -Wcompat -fwarn-redundant-constraints -threaded -rtsopts -with-rtsopts=-N build-depends:- base >=4.7 && <5+ base , base58-bytestring , bech32 , bytestring@@ -71,8 +67,13 @@ , memory , optparse-applicative , text+ ghc-options:+ -Wall -Wcompat -fwarn-redundant-constraints+ -threaded -rtsopts -with-rtsopts=-N if flag(release)- ghc-options: -Werror -static -O2+ ghc-options: -Werror+ if flag(static)+ ghc-options: -static cc-options: -static ld-options: -static -pthread default-language: Haskell2010@@ -85,11 +86,10 @@ hs-source-dirs: test ghc-options:- -threaded -rtsopts -with-rtsopts=-N -Wall- if (flag(werror))- ghc-options:- -Werror+ -threaded -rtsopts -with-rtsopts=-N+ if flag(release)+ ghc-options: -Werror build-depends: base , base58-bytestring