packages feed

amqp-utils 0.6.1.1 → 0.6.2.2

raw patch · 5 files changed

+26/−14 lines, 5 filesdep +filepath

Dependencies added: filepath

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for haskell-amqp-utils +## 0.6.2.2  -- 2021-08-25++* agitprop: option to move sent file to another dir instead of just removing+ ## 0.6.1.1  -- 2021-05-11  * disable inotify on non-linux
Network/AMQP/Utils/Options.hs view
@@ -70,6 +70,7 @@     , simple          :: Bool     , cleanupTmpFile  :: Bool     , removeSentFile  :: Bool+    , moveSentFileTo  :: Maybe FilePath     , initialScan     :: Bool     } @@ -123,6 +124,7 @@       False       False       False+      Nothing       False  -- | all options@@ -189,8 +191,8 @@         "AMQP routing key")   , ( "p"     , Option-        ['r','Q']-        ["routingkey","qname"]+        ['r', 'Q']+        ["routingkey", "qname"]         (ReqArg (\s o -> o {rKey = s}) "ROUTINGKEY")         "AMQP routing key")   , ( "ap"@@ -313,10 +315,9 @@   , ( "a"     , Option         ['u']-        ["remove"]-        (NoArg (\o -> o {removeSentFile = not (removeSentFile o)}))-        ("Toggle removal of sent file in hotfolder mode (default: " ++-         show (removeSentFile def) ++ ")"))+        ["remove", "move"]+        (OptArg (\s o -> o {removeSentFile = True, moveSentFileTo = s}) "DIR")+        ("Remove (or move to DIR) sent file in hotfolder mode"))   , ( "a"     , Option         ['d']
README.md view
@@ -95,7 +95,7 @@       -h HEADER=VALUE  --header=HEADER=VALUE              Message Headers       -F HEADERNAME    --fnheader=HEADERNAME              Put filename into this header       -S SUFFIX        --suffix=SUFFIX                    Allowed file suffixes in hotfolder mode-      -u               --remove                           Toggle removal of sent file in hotfolder mode (default: False)+      -u[DIR]          --remove[=DIR], --move[=DIR]       Remove (or move to DIR) sent file in hotfolder mode       -d               --dirscan                          Toggle initial directory scan in hotfolder mode (default: False)       -m               --magic                            Toggle setting content-type and -encoding from file contents (default: False)       -e               --persistent                       Set persistent delivery
agitprop.hs view
@@ -27,6 +27,7 @@ import           System.Directory import           System.Environment import           System.Exit+import           System.FilePath.Posix #if linux_HOST_OS import           System.INotify #endif@@ -46,7 +47,10 @@       else F.getFileStatus (inputFile args) >>= return . F.isDirectory   if isDir     then printparam "hotfolder" (inputFile args) >>-         printparam "initial scan" (initialScan args)+         printparam "initial scan" (initialScan args) >>+         if isNothing (moveSentFileTo args)+           then printparam "remove sent file" (removeSentFile args)+           else printparam "move sent file to" (moveSentFileTo args)     else printparam            "input file"            [ inputFile args@@ -54,7 +58,6 @@                then "(line-by-line)"                else ""            ]-  printparam "remove sent file" (removeSentFile args && isDir)   (conn, chan) <- connect args   addChannelExceptionHandler chan (X.throwTo tid)   printparam "confirm mode" $ confirm args@@ -194,14 +197,17 @@       , msgHeaders = substheader (fnheader a) fn $ msgheader a       } >>=     printparam "sent"-  removeSentFileIfRequested (removeSentFile a) fn+  removeSentFileIfRequested (removeSentFile a) (moveSentFileTo a) fn   where     substheader ::          [String] -> Maybe String -> Maybe FieldTable -> Maybe FieldTable     substheader (s:r) (Just fname) old =       substheader r (Just fname) (addheader old (s ++ "=" ++ fname))     substheader _ _ old = old-    removeSentFileIfRequested False _ = return ()-    removeSentFileIfRequested True Nothing = return ()-    removeSentFileIfRequested True (Just fname) =+    removeSentFileIfRequested False _ _ = return ()+    removeSentFileIfRequested True _ Nothing = return ()+    removeSentFileIfRequested True Nothing (Just fname) =       printparam "removing" fname >> removeFile fname+    removeSentFileIfRequested True (Just path) (Just fname) =+      printparam "moving" (fname ++ " to " ++ path) >>+      renameFile fname (replaceDirectory fname path)
amqp-utils.cabal view
@@ -1,6 +1,6 @@ name:                amqp-utils -version:             0.6.1.1+version:             0.6.2.2  synopsis:            AMQP toolset for the command line @@ -69,6 +69,7 @@                        time,                        process,                        directory,+                       filepath,                        bytestring,                        utf8-string,                        x509-system,