printparam' "client version" $ "amqp-utils " ++ (showVersion version)
printparam' "routing key" $ rKey args
printparam' "exchange" $ currentExchange args
- isDir <- F.getFileStatus (inputFile args) >>= return . F.isDirectory
+ isDir <-
+ if inputFile args == "-"
+ then return False
+ else F.getFileStatus (inputFile args) >>= return . F.isDirectory
if isDir
then printparam' "hotfolder" $ inputFile args
else printparam' "input file" $
hr $ "END watching " ++ (inputFile args)
else do
hr $ "BEGIN sending"
- messageFile <- BL.readFile (inputFile args)
+ messageFile <-
+ if inputFile args == "-"
+ then BL.getContents
+ else BL.readFile (inputFile args)
if (lineMode args)
then mapM_ (publishOneMsg Nothing) (BL.lines messageFile)
else publishOneMsg (Just (inputFile args)) messageFile
bindQueue chan q (T.pack $ currentExchange args) q
else return ()
printparam' "input file" $ inputFile args
- message <- BL.readFile (inputFile args)
+ message <-
+ if inputFile args == "-"
+ then BL.getContents
+ else BL.readFile (inputFile args)
printparam' "output file" $ outputFile args
h <- openBinaryFile (outputFile args) WriteMode
ctag <- consumeMsgs chan q NoAck (rpcClientCallback h tid args)