hopenpgp-tools 0.14 → 0.14.1
raw patch · 7 files changed
+73/−37 lines, 7 filesdep ~optparse-applicative
Dependency ranges changed: optparse-applicative
Files
- HOpenPGP/Tools/Common.hs +8/−3
- dist/build/hkt/hkt-tmp/HOpenPGP/Tools/Lexer.hs +25/−10
- dist/build/hkt/hkt-tmp/HOpenPGP/Tools/Parser.hs +2/−2
- dist/build/hot/hot-tmp/HOpenPGP/Tools/Lexer.hs +25/−10
- dist/build/hot/hot-tmp/HOpenPGP/Tools/Parser.hs +2/−2
- hopenpgp-tools.cabal +4/−4
- hot.hs +7/−6
HOpenPGP/Tools/Common.hs view
@@ -20,6 +20,7 @@ banner , versioner , warranty+ , prependAuto , keyMatchesFingerprint , keyMatchesEightOctetKeyId , keyMatchesExactUIDString@@ -61,15 +62,15 @@ import Data.Monoid ((<>)) import Data.Text (Text) import qualified Data.Text as T-import Options.Applicative.Builder (help, infoOption, long, short)-import Options.Applicative.Types (Parser)+import Options.Applicative.Builder (auto, help, infoOption, long, short)+import Options.Applicative.Types (Parser, ReadM(..)) import Text.PrettyPrint.ANSI.Leijen (Doc, (<+>), hardline, text) -- hmm -- import Data.Maybe (fromMaybe, mapMaybe) import Codec.Encryption.OpenPGP.KeyInfo (pubkeySize) import Control.Error.Util (hush)-import Control.Monad.Trans.Reader (ask, withReader, reader, Reader, runReader)+import Control.Monad.Trans.Reader (ask, withReader, reader, Reader, runReader, ReaderT, local) banner :: String -> Doc@@ -90,6 +91,9 @@ <> short 'V' <> help "Show version information" +prependAuto :: Read a => String -> ReadM a+prependAuto s = ReadM (local (s++) (unReadM auto))+ keyMatchesFingerprint :: Bool -> TK -> TwentyOctetFingerprint -> Bool keyMatchesFingerprint = keyMatchesPKPred fingerprint @@ -139,6 +143,7 @@ grabPKP (SecretSubkeyPkt p _) = Just p grabPKP _ = Nothing +anyOrAll :: (Monad m, Monad m1) => ((a1 -> c) -> a -> ReaderT a m b) -> (m1 a1 -> c) -> ReaderT a m b anyOrAll aa op = ask >>= aa (op . return) anyReader :: Reader a Bool -> Reader [a] Bool
dist/build/hkt/hkt-tmp/HOpenPGP/Tools/Lexer.hs view
@@ -42,16 +42,18 @@ #endif {-# LINE 1 "templates/wrappers.hs" #-} {-# LINE 1 "templates/wrappers.hs" #-}+{-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}+{-# LINE 8 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 17 "/usr/include/stdc-predef.h" 3 4 -# 1 "/usr/include/stdc-predef.h" 1 3 4 -# 17 "/usr/include/stdc-predef.h" 3 4 @@ -71,9 +73,7 @@ -# 47 "/usr/include/stdc-predef.h" 3 4 -# 59 "/usr/include/stdc-predef.h" 3 4 @@ -82,7 +82,15 @@ -{-# LINE 6 "<command-line>" #-}+++++++++{-# LINE 8 "<command-line>" #-} {-# LINE 1 "templates/wrappers.hs" #-} -- ----------------------------------------------------------------------------- -- Alex wrapper code.@@ -464,17 +472,19 @@ alex_action_65 = lex (TokenStr . reverse . drop 1 . reverse . drop 1) {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}+{-# LINE 9 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 17 "/usr/include/stdc-predef.h" 3 4 -# 1 "/usr/include/stdc-predef.h" 1 3 4 -# 17 "/usr/include/stdc-predef.h" 3 4 @@ -494,9 +504,7 @@ -# 47 "/usr/include/stdc-predef.h" 3 4 -# 59 "/usr/include/stdc-predef.h" 3 4 @@ -505,7 +513,14 @@ -{-# LINE 7 "<command-line>" #-}++++++++{-# LINE 9 "<command-line>" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- ----------------------------------------------------------------------------- -- ALEX TEMPLATE
dist/build/hkt/hkt-tmp/HOpenPGP/Tools/Parser.hs view
@@ -958,7 +958,7 @@ {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}-{-# LINE 8 "<command-line>" #-}+{-# LINE 10 "<command-line>" #-} # 1 "/usr/include/stdc-predef.h" 1 3 4 # 17 "/usr/include/stdc-predef.h" 3 4@@ -1004,7 +1004,7 @@ -{-# LINE 8 "<command-line>" #-}+{-# LINE 10 "<command-line>" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp
dist/build/hot/hot-tmp/HOpenPGP/Tools/Lexer.hs view
@@ -42,16 +42,18 @@ #endif {-# LINE 1 "templates/wrappers.hs" #-} {-# LINE 1 "templates/wrappers.hs" #-}+{-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}+{-# LINE 8 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 17 "/usr/include/stdc-predef.h" 3 4 -# 1 "/usr/include/stdc-predef.h" 1 3 4 -# 17 "/usr/include/stdc-predef.h" 3 4 @@ -71,9 +73,7 @@ -# 47 "/usr/include/stdc-predef.h" 3 4 -# 59 "/usr/include/stdc-predef.h" 3 4 @@ -82,7 +82,15 @@ -{-# LINE 6 "<command-line>" #-}+++++++++{-# LINE 8 "<command-line>" #-} {-# LINE 1 "templates/wrappers.hs" #-} -- ----------------------------------------------------------------------------- -- Alex wrapper code.@@ -464,17 +472,19 @@ alex_action_65 = lex (TokenStr . reverse . drop 1 . reverse . drop 1) {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}+{-# LINE 9 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 17 "/usr/include/stdc-predef.h" 3 4 -# 1 "/usr/include/stdc-predef.h" 1 3 4 -# 17 "/usr/include/stdc-predef.h" 3 4 @@ -494,9 +504,7 @@ -# 47 "/usr/include/stdc-predef.h" 3 4 -# 59 "/usr/include/stdc-predef.h" 3 4 @@ -505,7 +513,14 @@ -{-# LINE 7 "<command-line>" #-}++++++++{-# LINE 9 "<command-line>" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- ----------------------------------------------------------------------------- -- ALEX TEMPLATE
dist/build/hot/hot-tmp/HOpenPGP/Tools/Parser.hs view
@@ -958,7 +958,7 @@ {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}-{-# LINE 8 "<command-line>" #-}+{-# LINE 10 "<command-line>" #-} # 1 "/usr/include/stdc-predef.h" 1 3 4 # 17 "/usr/include/stdc-predef.h" 3 4@@ -1004,7 +1004,7 @@ -{-# LINE 8 "<command-line>" #-}+{-# LINE 10 "<command-line>" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp
hopenpgp-tools.cabal view
@@ -1,5 +1,5 @@ name: hopenpgp-tools-version: 0.14+version: 0.14.1 synopsis: hOpenPGP-based command-line tools description: command-line tools for performing some OpenPGP-related operations homepage: http://floss.scru.org/hopenpgp-tools@@ -32,7 +32,7 @@ , lens , monad-loops , openpgp-asciiarmor >= 0.1- , optparse-applicative >= 0.10.0+ , optparse-applicative >= 0.11.0 , resourcet , text , transformers@@ -65,7 +65,7 @@ , lens , monad-loops , old-locale- , optparse-applicative >= 0.10.0+ , optparse-applicative >= 0.11.0 , resourcet , text , time@@ -100,7 +100,7 @@ , ixset , lens , monad-loops- , optparse-applicative >= 0.10.0+ , optparse-applicative >= 0.11.0 , resourcet , text , time
hot.hs view
@@ -19,7 +19,7 @@ -- along with this program. If not, see <http://www.gnu.org/licenses/>. import Paths_hopenpgp_tools (version)-import HOpenPGP.Tools.Common (banner, versioner, warranty)+import HOpenPGP.Tools.Common (banner, versioner, warranty, prependAuto) import HOpenPGP.Tools.Parser (parsePExp) import qualified Codec.Encryption.OpenPGP.ASCIIArmor as AA import Codec.Encryption.OpenPGP.ASCIIArmor.Types (Armor(..), ArmorType(..))@@ -45,7 +45,7 @@ import System.IO (stdin, stderr, stdout, Handle, hFlush, hPutStrLn, hSetBuffering, BufferMode(..)) -import Options.Applicative.Builder (auto, argument, command, footerDoc, headerDoc, help, helpDoc, info, long, metavar, option, eitherReader, prefs, progDesc, showDefaultWith, showHelpOnError, str, strOption, subparser, value)+import Options.Applicative.Builder (argument, command, footerDoc, headerDoc, help, helpDoc, info, long, metavar, option, eitherReader, prefs, progDesc, showDefaultWith, showHelpOnError, str, strOption, subparser, value) import Options.Applicative.Extra (customExecParser, helper) import Options.Applicative.Types (Parser) import Text.PrettyPrint.ANSI.Leijen ((<+>), hardline, hPutDoc, list, softline, text)@@ -66,7 +66,7 @@ fExpression :: String } -data DumpOutputFormat = DumpPretty | DumpJSON | DumpYAML+data DumpOutputFormat = DumpPretty | DumpJSON | DumpYAML | DumpShow deriving (Bounded, Enum, Read, Show) doDump :: DumpOptions -> IO ()@@ -74,10 +74,11 @@ DumpPretty -> prettyPrinter DumpJSON -> jsonSink DumpYAML -> yamlSink+ DumpShow -> printer -- Print every input value to standard output.--- printer :: (Show a, MonadIO m) => Sink a m ()--- printer = CL.mapM_ (liftIO . print)+printer :: (Show a, MonadIO m) => Sink a m ()+printer = CL.mapM_ (liftIO . print) prettyPrinter :: (Pretty a, MonadIO m) => Sink a m () prettyPrinter = CL.mapM_ (liftIO . putStrLn . show . pretty)@@ -117,7 +118,7 @@ doP :: Parser DumpOptions doP = DumpOptions- <$> option (auto <$> ("Dump"++))+ <$> option (prependAuto "Dump") ( long "output-format" <> metavar "FORMAT" <> value DumpPretty