]> woffs.de Git - fd/haskell-amqp-utils.git/commitdiff
introduce -s
authorFrank Doepper <[email protected]>
Sat, 7 Dec 2019 22:26:28 +0000 (23:26 +0100)
committerFrank Doepper <[email protected]>
Sat, 7 Dec 2019 22:26:28 +0000 (23:26 +0100)
Network/AMQP/Utils/Helpers.hs
Network/AMQP/Utils/Options.hs

index 4ca75a8d23a365cb714f0c0b157cf721378b6a22..45156fa4652251fe0dbc302d4b78bb0403ba57db 100644 (file)
@@ -18,6 +18,7 @@ import System.Exit
 import System.IO
 import System.Process
 
+-- | print config parameters
 class (Show a) =>
       Flexprint a
   where
@@ -230,7 +231,7 @@ optionalFileStuff (msg, envi) callbackoptions addi numstring a tid action = do
   printparam "saved to" path
   let callbackcmdline =
         liftM2
-          (constructCallbackCmdLine callbackoptions addi numstring)
+          (constructCallbackCmdLine (simple a) callbackoptions addi numstring)
           (fileProcess a)
           path
   printparam "calling" callbackcmdline
@@ -257,8 +258,9 @@ saveFile (Just tempD) numstring body = do
 
 -- | construct cmdline for callback script
 constructCallbackCmdLine ::
-     [String] -> [String] -> String -> String -> String -> [String]
-constructCallbackCmdLine opts addi num exe path =
+     Bool -> [String] -> [String] -> String -> String -> String -> [String]
+constructCallbackCmdLine True _ _ _ exe path = exe : path : []
+constructCallbackCmdLine False opts addi num exe path =
   exe : "-f" : path : "-n" : num : opts ++ addi
 
 -- | call callback script
index d01a4eb05755d7b25d5de816c66e8a6edc5fa0fd..8f16c245668e364203e837b6d0fca09169fe7ffb 100644 (file)
@@ -56,6 +56,7 @@ data Args = Args
   , requeuenack :: Bool
   , rpc_timeout :: Double
   , connect_timeout :: Int
+  , simple :: Bool
   }
 
 instance Default Args where
@@ -105,6 +106,7 @@ instance Default Args where
       True
       5
       60
+      False
 
 -- | all options
 allOptions :: [(String, OptDescr (Args -> Args))]
@@ -315,6 +317,12 @@ allOptions =
         ["queue"]
         (ReqArg (\s o -> o {qName = Just s}) "QUEUENAME")
         "Ignore Exchange and bind to existing Queue")
+  , ( "kr"
+    , Option
+        ['i']
+        ["simple"]
+        (NoArg (\o -> o {simple = True}))
+        "call callback with one arg (filename) only")
   , ( "krp"
     , Option
         ['Q']
don't click here