ip6addr 1.0.3 → 1.0.4
raw patch · 3 files changed
+43/−45 lines, 3 filesdep ~text
Dependency ranges changed: text
Files
- README.md +1/−1
- app/Main.hs +11/−10
- ip6addr.cabal +31/−34
README.md view
@@ -1,4 +1,4 @@-# ip6addr [](https://travis-ci.org/MichelBoucey/ip6addr)+# ip6addr  A commandline tool that validates and generates IPv6 address text representations
app/Main.hs view
@@ -1,20 +1,19 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-} import Control.Monad (replicateM_)-import Data.Monoid ((<>)) import qualified Data.Text as T import qualified Data.Text.IO as TIO (hPutStrLn, putStrLn)+import Data.Version (showVersion)+import Paths_ip6addr (version) import System.Console.CmdArgs import System.Exit import System.IO (stderr) import Text.IPv6Addr -version :: String-version = "1.0.4"- data Input = Input { output :: String , address :: String@@ -35,7 +34,7 @@ , prefix = "" &= typ " <Prefix>" &= help "Set a prefix for random addresses generation"- } &= summary ("ip6addr version " <> version <> " (c) Michel Boucey 2011-2021")+ } &= summary ("ip6addr " <> showVer <> " (c) Michel Boucey 2011-2023") &= program "ip6addr" &= helpArg [name "h"] &= details [ "Examples:"@@ -46,6 +45,9 @@ , "" ] +showVer :: String+showVer = "v" <> showVersion version+ main :: IO () main = do Input{..} <- cmdArgs ip6addrInput@@ -53,9 +55,9 @@ then replicateM_ quantity (putRandAddr prefix) >> exitSuccess else case output of- "canonical" -> out maybeIPv6Addr address fromIPv6Addr- "pure" -> out maybePureIPv6Addr address fromIPv6Addr- "full" -> out maybeFullIPv6Addr address fromIPv6Addr+ "canonical" -> out maybeIPv6Addr address unIPv6Addr+ "pure" -> out maybePureIPv6Addr address unIPv6Addr+ "full" -> out maybeFullIPv6Addr address unIPv6Addr "arpa" -> out maybeIP6ARPA address id "unc" -> out maybeUNC address id _ -> TIO.hPutStrLn stderr "See help" >> exitFailure@@ -63,7 +65,7 @@ putRandAddr p = do r <- randIPv6AddrWithPrefix (if p == mempty then Nothing else Just (T.pack p)) case r of- Just a -> TIO.putStrLn (fromIPv6Addr a)+ Just a -> TIO.putStrLn (unIPv6Addr a) Nothing -> TIO.putStrLn "Bad prefix" out t i o = if i /= mempty@@ -76,5 +78,4 @@ else Prelude.putStrLn "See help" >> exitFailure maybeUNC t = toUNC <$> maybePureIPv6Addr t maybeIP6ARPA t = toIP6ARPA <$> maybeFullIPv6Addr t- fromIPv6Addr (IPv6Addr a) = a
ip6addr.cabal view
@@ -1,37 +1,34 @@-cabal-version: >=1.10-name: ip6addr-version: 1.0.3-license: BSD3-license-file: LICENSE-copyright: Copyright (c) 2011-2022 - Michel Boucey-maintainer: michel.boucey@gmail.com-author: Michel Boucey-tested-with:- ghc ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.1 || ==9.2.1--homepage: https://github.com/MichelBoucey/ip6addr-synopsis:- Commandline tool to deal with IPv6 address text representations--description:- Commandline tool to validate, canonize and generate IPv6 address text representations--category: Network,Console-build-type: Simple-extra-source-files: README.md+name: ip6addr+version: 1.0.4+synopsis: Commandline tool to deal with IPv6 address text representations+description: Commandline tool to validate, canonize and generate IPv6 address text representations+license: BSD3+license-file: LICENSE+author: Michel Boucey+maintainer: michel.boucey@gmail.com+homepage: https://github.com/MichelBoucey/ip6addr+Copyright: Copyright (c) 2011-2024 - Michel Boucey+Category: Network,Console+build-type: Simple+cabal-version: >=1.10+extra-source-files: README.md+ +Tested-With: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.3 || ==9.8.1 -source-repository head- type: git- location: https://github.com/MichelBoucey/ip6addr.git+Source-Repository head+ Type: git+ Location: https://github.com/MichelBoucey/ip6addr.git executable ip6addr- main-is: Main.hs- hs-source-dirs: app- default-language: Haskell2010- other-extensions: DeriveDataTypeable OverloadedStrings- ghc-options: -Wall- build-depends:- base >=4.8 && <5,- cmdargs >=0.10.13 && <0.11,- IPv6Addr >=2.0.0 && <2.1,- text >=1.2.2 && <1.3 || ==2.0.*+ hs-source-dirs: app+ main-is: Main.hs+ other-modules: Paths_ip6addr+ other-extensions: DeriveDataTypeable+ , OverloadedStrings+ build-depends: base >= 4.8 && < 5+ , cmdargs >= 0.10.13 && < 0.11+ , IPv6Addr >= 2.0.0 && < 2.1+ , text >=1.1 && < 2.2+ default-language: Haskell2010+ GHC-Options: -Wall+