packages feed

hopenpgp-tools 0.21 → 0.21.1

raw patch · 5 files changed

+72/−45 lines, 5 filesdep +prettyprinter-convert-ansi-wl-pprintdep −ansi-wl-pprint

Dependencies added: prettyprinter-convert-ansi-wl-pprint

Dependencies removed: ansi-wl-pprint

Files

HOpenPGP/Tools/Common.hs view
@@ -64,7 +64,7 @@ import qualified Data.Text as T import Options.Applicative.Builder (auto, help, hidden, infoOption, long, short) import Options.Applicative.Types (Parser, ReadM(..))-import Text.PrettyPrint.ANSI.Leijen (Doc, (<+>), hardline, text)+import Data.Text.Prettyprint.Doc (Doc, (<+>), hardline, pretty)  -- hmm -- import Data.Maybe (fromMaybe, mapMaybe)@@ -73,16 +73,16 @@ import Control.Monad.Trans.Reader (ask, withReader, reader, Reader, runReader, ReaderT, local)  -banner :: String -> Doc+banner :: String -> Doc ann {-# INLINE banner #-}-banner name = text name <+> text "(hopenpgp-tools)" <+> text (showVersion version) <> hardline-     <> text "Copyright (C) 2012-2018  Clint Adams"+banner name = pretty name <+> pretty "(hopenpgp-tools)" <+> pretty (showVersion version) <> hardline+     <> pretty "Copyright (C) 2012-2018  Clint Adams" -warranty :: String -> Doc+warranty :: String -> Doc ann {-# INLINE warranty #-}-warranty name = text name <+> text "comes with ABSOLUTELY NO WARRANTY." <+>-     text "This is free software, and you are welcome to redistribute it" <+>-     text "under certain conditions."+warranty name = pretty name <+> pretty "comes with ABSOLUTELY NO WARRANTY." <+>+     pretty "This is free software, and you are welcome to redistribute it" <+>+     pretty "under certain conditions."  versioner :: String -> Parser (a -> a) {-# INLINE versioner #-}
hkt.hs view
@@ -82,9 +82,9 @@ import Options.Applicative.Types (Parser)  import System.IO (Handle, hFlush, stderr, hSetBuffering, BufferMode(..))-import qualified Text.PrettyPrint.ANSI.Leijen as PPAL-import Data.Text.Prettyprint.Doc ((<+>), hardline, pretty)-import Data.Text.Prettyprint.Doc.Render.Text (putDoc)+import Data.Text.Prettyprint.Doc ((<+>), fillSep, hardline, list, pretty)+import Data.Text.Prettyprint.Doc.Render.Text (putDoc, hPutDoc)+import Data.Text.Prettyprint.Convert.AnsiWlPprint (toAnsiWlPprint)  grabMatchingKeysConduit :: (MonadResource m, MonadThrow m) => FilePath -> Bool -> Text -> ConduitM () TK m () grabMatchingKeysConduit fp filt srch = CB.sourceFile fp .| conduitGet get .| conduitToTKsDropping .| (if filt then conduitTKFilter ufp else CL.filter matchAny)@@ -176,7 +176,7 @@     <*> pure ""     <*> pure ""     where-        targetHelp = helpDoc . Just $ PPAL.text "target (which keys to output)*"+        targetHelp = helpDoc . Just . toAnsiWlPprint $ pretty "target (which keys to output)*"  graphO :: String -> Parser Options graphO homedir = Options@@ -196,9 +196,9 @@     <*> pure ""     <*> pure ""     where-        ofhelp = helpDoc . Just $ PPAL.text "output format" <> PPAL.hardline <> PPAL.list (map (PPAL.text . show) ofchoices)+        ofhelp = helpDoc . Just . toAnsiWlPprint $ pretty "output format" <> hardline <> list (map (pretty . show) ofchoices)         ofchoices = [minBound..maxBound] :: [GraphOutputFormat]-        targetHelp = helpDoc . Just $ PPAL.text "target (which keys to graph)*"+        targetHelp = helpDoc . Just . toAnsiWlPprint $ pretty "target (which keys to graph)*"  findPathsO :: String -> Parser Options findPathsO homedir = Options@@ -218,9 +218,9 @@     <*> argument str ( metavar "FROM-KEYS" <> fromHelp )     <*> argument str ( metavar "TO-KEYS" <> toHelp )     where-        targetHelp = helpDoc . Just $ PPAL.text "target (which keys to use in pathfinding)*"-        fromHelp = helpDoc . Just $ PPAL.text "from (which keys to use for the source of paths)*"-        toHelp = helpDoc . Just $ PPAL.text "to (which keys to use for the destinations of paths)*"+        targetHelp = helpDoc . Just . toAnsiWlPprint $ pretty "target (which keys to use in pathfinding)*"+        fromHelp = helpDoc . Just . toAnsiWlPprint $ pretty "from (which keys to use for the source of paths)*"+        toHelp = helpDoc . Just . toAnsiWlPprint $ pretty "to (which keys to use for the destinations of paths)*"  dispatch :: Command -> IO () dispatch (CmdList o) = banner' stderr >> hFlush stderr >> doList o@@ -232,7 +232,11 @@ main = do     hSetBuffering stderr LineBuffering     homedir <- getHomeDirectory-    customExecParser (prefs showHelpOnError) (info (helper <*> versioner "hkt" <*> cmd homedir) (headerDoc (Just (banner "hkt")) <> progDesc "hOpenPGP Keyring Tool" <> footerDoc (Just (warranty "hkt")))) >>= dispatch+    customExecParser (prefs showHelpOnError)+                     (info (helper <*> versioner "hkt" <*> cmd homedir)+                           (headerDoc (Just (toAnsiWlPprint (banner "hkt")))+                           <> progDesc "hOpenPGP Keyring Tool"+                           <> footerDoc (Just (toAnsiWlPprint (warranty "hkt"))))) >>= dispatch  cmd :: String -> Parser Command cmd homedir = hsubparser@@ -242,14 +246,18 @@    <> command "list" (info ( CmdList <$> listO homedir) ( progDesc "list matching keys" <> footerDoc (Just foot) ))     )     where-        foot = PPAL.hardline <> PPAL.text "*if --filter is not specified, this must be"-               PPAL.</> PPAL.text "a fingerprint," PPAL.</> PPAL.text "an eight-octet key ID,"-               PPAL.</> PPAL.text "or a substring of a UID (including an empty string)" <> PPAL.hardline-               <> PPAL.text "if --filter is specified, it must be"-               PPAL.</> PPAL.text "something in filter syntax (see source)."+        foot = toAnsiWlPprint $ hardline <> fillSep [+                   pretty "*if --filter is not specified, this must be"+                 , pretty "a fingerprint,"+                 , pretty "an eight-octet key ID,"+                 , pretty "or a substring of a UID (including an empty string)"]+               <> hardline+               <> fillSep [pretty "if --filter is specified, it must be"+                          , pretty "something in filter syntax (see source)."+                          ]  banner' :: Handle -> IO ()-banner' h = PPAL.hPutDoc h (banner "hkt" <> PPAL.hardline <> warranty "hkt" <> PPAL.hardline)+banner' h = hPutDoc h (banner "hkt" <> hardline <> warranty "hkt" <> hardline)  doList :: Options -> IO () doList o = do
hokey.hs view
@@ -58,7 +58,11 @@ #if !MIN_VERSION_base(4,8,0) import Data.Monoid (mconcat, Monoid(..)) #endif+#if !MIN_VERSION_base(4,9,0) import Data.Monoid ((<>))+#else+import Data.Semigroup ((<>), Semigroup)+#endif import Data.Ord (comparing, Down(..)) import qualified Data.Set as Set import Data.Text (Text)@@ -75,9 +79,9 @@ import System.IO (Handle, hFlush, hPutStrLn, stderr, stdin, stdout, hSetBuffering, BufferMode(..)) import Data.Time.Locale.Compat (defaultTimeLocale) -import qualified Text.PrettyPrint.ANSI.Leijen as PPAL-import Data.Text.Prettyprint.Doc (annotate, colon, flatAlt, indent, line, list, pretty, (<+>), Doc)+import Data.Text.Prettyprint.Doc (annotate, colon, flatAlt, hardline, indent, line, list, pretty, (<+>), Doc) import qualified Data.Text.Prettyprint.Doc.Render.Terminal as PPA+import Data.Text.Prettyprint.Convert.AnsiWlPprint (toAnsiWlPprint)  linebreak = flatAlt line mempty green = annotate (PPA.color PPA.Green)@@ -153,9 +157,18 @@     toJSON = A.toJSON . Map.fromList . unFakeMap instance A.ToJSON RevocationStatus +#if MIN_VERSION_base(4,9,0)+instance Semigroup UIDReport where+    (<>) (UIDReport a b c d e) (UIDReport a' b' c' d' e') = UIDReport (a <> a') (b <> b') (c <> c') (d <> d') (e <> e')+#endif+ instance Monoid UIDReport where     mempty = UIDReport [] [] [] [] []+#if !MIN_VERSION_base(4,9,0)     mappend (UIDReport a b c d e) (UIDReport a' b' c' d' e') = UIDReport (a <> a') (b <> b') (c <> c') (d <> d') (e <> e')+#else+    mappend = (<>)+#endif  checkKey :: Maybe POSIXTime -> TK -> KeyReport checkKey mpt key = (\x -> x { keyBestOf = populateBestOf x, keyHasEncryptionCapableSubkey = hasEncryptionCapableSubkey (concatMap skUsageFlags (keySubkeys x)) }) KeyReport {@@ -341,7 +354,7 @@        <> ofHelp         )     where-        ofHelp = helpDoc . Just $ PPAL.text "output format" <> PPAL.hardline <> PPAL.list (map (PPAL.text . show) ofchoices)+        ofHelp = helpDoc . Just . toAnsiWlPprint $ pretty "output format" <> hardline <> list (map (pretty . show) ofchoices)         ofchoices = [minBound..maxBound] :: [LintOutputFormat]  fetchO :: Parser FetchOptions@@ -362,7 +375,7 @@         )     <*> argument (eitherReader strToFP) ( metavar "FINGERPRINT" )     where-        vmHelp = helpDoc . Just $ PPAL.text "validation method" <> PPAL.hardline <> PPAL.list (map (PPAL.text . show) vmchoices)+        vmHelp = helpDoc . Just . toAnsiWlPprint $ pretty "validation method" <> hardline <> list (map (pretty . show) vmchoices)         vmchoices = [minBound..maxBound] :: [FetchValidationMethod]         strToFP = parseFingerprint . T.pack @@ -374,7 +387,11 @@ main :: IO () main = do     hSetBuffering stderr LineBuffering-    customExecParser (prefs showHelpOnError) (info (helper <*> versioner "hokey" <*> cmd) (headerDoc (Just (banner "hokey")) <> progDesc "hOpenPGP Key utility" <> footerDoc (Just (warranty "hokey")))) >>= dispatch+    customExecParser (prefs showHelpOnError)+                     (info (helper <*> versioner "hokey" <*> cmd)+                           (headerDoc (Just (toAnsiWlPprint (banner "hokey")))+                         <> progDesc "hOpenPGP Key utility"+                         <> footerDoc (Just (toAnsiWlPprint (warranty "hokey"))))) >>= dispatch  cmd :: Parser Command cmd = hsubparser@@ -414,7 +431,7 @@         Right ks -> B.putStr $ rearmorKeys ks  banner' :: Handle -> IO ()-banner' h = PPAL.hPutDoc h (banner "hokey" <> PPAL.hardline <> warranty "hokey" <> PPAL.hardline)+banner' h = PPA.hPutDoc h (banner "hokey" <> hardline <> warranty "hokey" <> hardline)  sigissuer :: SignaturePayload -> Maybe EightOctetKeyId getIssuer :: SigSubPacketPayload -> Maybe EightOctetKeyId
hopenpgp-tools.cabal view
@@ -1,5 +1,5 @@ name:                hopenpgp-tools-version:             0.21+version:             0.21.1 synopsis:            hOpenPGP-based command-line tools description:         command-line tools for performing some OpenPGP-related operations homepage:            https://salsa.debian.org/clint/hOpenPGP@@ -20,7 +20,6 @@                ,       HOpenPGP.Tools.Parser   build-depends:       base                   > 4         && < 5                ,       aeson-               ,       ansi-wl-pprint         >= 0.6.7                ,       array                ,       binary                 >= 0.6.4.0                ,       binary-conduit@@ -34,7 +33,7 @@                ,       openpgp-asciiarmor     >= 0.1                ,       optparse-applicative   >= 0.11.0                ,       prettyprinter-               ,       resourcet+               ,       prettyprinter-convert-ansi-wl-pprint                ,       text                ,       transformers                ,       yaml@@ -50,7 +49,6 @@                ,       HOpenPGP.Tools.TKUtils   build-depends:       base                   > 4         && < 5                ,       aeson-               ,       ansi-wl-pprint         >= 0.6.7                ,       base16-bytestring                ,       binary                 >= 0.6.4.0                ,       binary-conduit@@ -73,7 +71,7 @@                ,       optparse-applicative   >= 0.11.0                ,       prettyprinter                ,       prettyprinter-ansi-terminal-               ,       resourcet+               ,       prettyprinter-convert-ansi-wl-pprint                ,       text                ,       time                ,       time-locale-compat@@ -89,7 +87,6 @@                ,       HOpenPGP.Tools.Parser   build-depends:       base                   > 4         && < 5                ,       aeson-               ,       ansi-wl-pprint         >= 0.6.7                ,       array                ,       attoparsec             >= 0.10.0.0                ,       binary                 >= 0.6.4.0@@ -109,6 +106,7 @@                ,       monad-loops                ,       optparse-applicative   >= 0.11.0                ,       prettyprinter+               ,       prettyprinter-convert-ansi-wl-pprint                ,       resourcet                ,       text                ,       time@@ -126,4 +124,4 @@ source-repository this   type:     git   location: https://salsa.debian.org/clint/hOpenPGP.git-  tag:      hopenpgp-tools/0.21+  tag:      hopenpgp-tools/0.21.1
hot.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings, RecordWildCards #-}+{-# LANGUAGE RecordWildCards #-}  -- hot.hs: hOpenPGP Tool -- Copyright © 2012-2018  Clint Adams@@ -53,9 +53,9 @@ import Options.Applicative.Builder (argument, command, footerDoc, headerDoc, help, helpDoc, info, long, metavar, option, eitherReader, prefs, progDesc, showDefaultWith, showHelpOnError, str, strOption, value) import Options.Applicative.Extra (customExecParser, helper, hsubparser) import Options.Applicative.Types (Parser)-import qualified Text.PrettyPrint.ANSI.Leijen as PPAL-import Data.Text.Prettyprint.Doc (group, hardline, Pretty, pretty)+import Data.Text.Prettyprint.Doc ((<+>), group, hardline, list, Pretty, pretty, softline) import Data.Text.Prettyprint.Doc.Render.Text (hPutDoc)+import Data.Text.Prettyprint.Convert.AnsiWlPprint (toAnsiWlPprint)  data Command = DumpC DumpOptions | DeArmorC | ArmorC ArmoringOptions | FilterC FilteringOptions @@ -131,7 +131,7 @@     <> showDefaultWith (drop 4 . show)     <> ofHelp )     where-        ofHelp = helpDoc . Just $ PPAL.text "output format" <> PPAL.hardline <> PPAL.list (map (PPAL.text . drop 4 . show) ofchoices)+        ofHelp = helpDoc . Just . toAnsiWlPprint $ pretty "output format" <> hardline <> list (map (pretty . drop 4 . show) ofchoices)         ofchoices = [minBound..maxBound] :: [DumpOutputFormat]  aoP :: Parser ArmoringOptions@@ -139,13 +139,13 @@     <$> optional (strOption (long "comment" <> metavar "COMMENT" <> help "ASCII armor Comment field"))     <*> option (eitherReader armorTypeReader) (long "armor-type" <> metavar "ARMORTYPE" <> armortypeHelp)     where-        armortypeHelp = helpDoc . Just $ PPAL.text "ASCII armor type" <> PPAL.softline <> PPAL.list (map (PPAL.text . fst) armorTypes)+        armortypeHelp = helpDoc . Just . toAnsiWlPprint $ pretty "ASCII armor type" <> softline <> list (map (pretty . fst) armorTypes)  foP :: Parser FilteringOptions foP = FilteringOptions     <$> argument str ( metavar "EXPRESSION" <> filterTargetHelp )     where-        filterTargetHelp = helpDoc . Just $ PPAL.text "packet filter expression" PPAL.<+> PPAL.softline <> PPAL.text "see source for current syntax"+        filterTargetHelp = helpDoc . Just . toAnsiWlPprint $ pretty "packet filter expression" <+> softline <> pretty "see source for current syntax"  dispatch :: Command -> IO () dispatch c = (banner' stderr >> hFlush stderr) >> dispatch' c@@ -158,7 +158,11 @@ main :: IO () main = do     hSetBuffering stderr LineBuffering-    customExecParser (prefs showHelpOnError) (info (helper <*> versioner "hot" <*> cmd) (headerDoc (Just (banner "hot")) <> progDesc "hOpenPGP OpenPGP-message Tool" <> footerDoc (Just (warranty "hot")))) >>= dispatch+    customExecParser (prefs showHelpOnError)+                     (info (helper <*> versioner "hot" <*> cmd)+                     (headerDoc (Just (toAnsiWlPprint (banner "hot")))+                   <> progDesc "hOpenPGP OpenPGP-message Tool"+                   <> footerDoc (Just (toAnsiWlPprint (warranty "hot"))))) >>= dispatch  cmd :: Parser Command cmd = hsubparser@@ -169,7 +173,7 @@   )  banner' :: Handle -> IO ()-banner' h = PPAL.hPutDoc h (banner "hot" <> PPAL.hardline <> warranty "hot" <> PPAL.hardline)+banner' h = hPutDoc h (banner "hot" <> hardline <> warranty "hot" <> hardline)  parseExpressions :: FilteringOptions -> FilterPredicates parseExpressions FilteringOptions{..} = RPFilterPredicate (parseE fExpression)