import System.IO
import System.Process
+-- | print config parameters
class (Show a) =>
Flexprint a
where
printparam "saved to" path
let callbackcmdline =
liftM2
- (constructCallbackCmdLine callbackoptions addi numstring)
+ (constructCallbackCmdLine (simple a) callbackoptions addi numstring)
(fileProcess a)
path
printparam "calling" callbackcmdline
-- | 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
, requeuenack :: Bool
, rpc_timeout :: Double
, connect_timeout :: Int
+ , simple :: Bool
}
instance Default Args where
True
5
60
+ False
-- | all options
allOptions :: [(String, OptDescr (Args -> Args))]
["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']