hsftp 1.3.1 → 1.4.0
raw patch · 15 files changed
+57/−59 lines, 15 filesdep −filepath-bytestringdep ~aesondep ~bytestringdep ~directoryPVP ok
version bump matches the API change (PVP)
Dependencies removed: filepath-bytestring
Dependency ranges changed: aeson, bytestring, directory, filepath, tasty, tasty-hunit, tasty-quickcheck
API changes (from Hackage documentation)
- Reader: Env :: String -> Int -> String -> String -> FilePath -> FilePath -> FilePath -> [ByteString] -> Maybe FilePath -> Integer -> Bool -> Env
+ Reader: Env :: String -> Int -> String -> String -> FilePath -> FilePath -> FilePath -> [String] -> Maybe FilePath -> Integer -> Bool -> Env
- Reader: [transferExtensions] :: Env -> [ByteString]
+ Reader: [transferExtensions] :: Env -> [String]
Files
- CHANGELOG.md +7/−0
- LICENSE +1/−1
- README.md +2/−2
- app/Main.hs +1/−2
- hsftp.cabal +20/−23
- src/CmdOptions.hs +1/−1
- src/Commands.hs +4/−6
- src/Config.hs +1/−1
- src/Options.hs +1/−1
- src/Reader.hs +2/−3
- src/Util.hs +1/−1
- test/Spec.hs +1/−1
- test/TestCommands.hs +13/−15
- test/TestReader.hs +1/−1
- test/TestUtil.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,10 @@+## v1.4.0 (2025-06-09)++### Build++- **dep**: remove `filepath-bytestring` dependency+- **resolver**: update to `lts-23.24`+ ## v1.3.1 (2024-11-12) ### Fix
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2024 Maurizio Dusi+Copyright 2024-present IOcrafts Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
README.md view
@@ -1,12 +1,12 @@ # Hsftp: a SFTP client tool for secure file transfer operations. -[](https://github.com/mdusi/hsftp/actions/workflows/release.yml)+[](https://github.com/iocrafts/hsftp/actions/workflows/release.yml) Usage of hsftp -------------- ```-Hsftp 1.3.1. Usage: hsftp OPTION+Hsftp 1.4.0. Usage: hsftp OPTION hsftp [OPTIONS] [ITEM]
app/Main.hs view
@@ -11,7 +11,6 @@ import Control.Monad ( when ) import Control.Monad.Reader -import qualified Data.ByteString.Char8 as C import qualified Data.Yaml as Y import Options ( Direction (..), Options (..) )@@ -62,7 +61,7 @@ env' = env { date = date , transferFrom = src , transferTo = dst- , transferExtensions = map C.pack extensions+ , transferExtensions = extensions , archiveTo = archive }
hsftp.cabal view
@@ -1,13 +1,13 @@ cabal-version: 2.2 name: hsftp-version: 1.3.1+version: 1.4.0 license: BSD-3-Clause license-file: LICENSE-copyright: (c) 2024 Maurizio Dusi+copyright: (c) 2024-present IOcrafts maintainer: Maurizio Dusi author: Maurizio Dusi-homepage: https://mdusi.github.io/hsftp/-bug-reports: https://github.com/mdusi/hsftp/issues+homepage: https://iocrafts.github.io/hsftp/+bug-reports: https://github.com/iocrafts/hsftp/issues synopsis: A SFTP client tool for secure file transfer operations description: Hsftp is a command-line tool for secure file transfer operations@@ -19,7 +19,7 @@ source-repository head type: git- location: https://github.com/mdusi/hsftp+ location: https://github.com/iocrafts/hsftp library exposed-modules:@@ -42,13 +42,12 @@ -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints build-depends:- aeson >=2.1.2.1 && <2.2,+ aeson >=2.2.3.0 && <2.3, base >=4.7 && <5,- bytestring >=0.11.5.3 && <0.12,+ bytestring >=0.12.1.0 && <0.13, cmdargs >=0.10.22 && <0.11,- directory >=1.3.8.4 && <1.4,- filepath >=1.4.300.1 && <1.5,- filepath-bytestring >=1.4.2.1.13 && <1.5,+ directory >=1.3.8.5 && <1.4,+ filepath >=1.4.301.0 && <1.5, libssh2 >=0.2.0.9 && <0.3, mtl >=2.3.1 && <2.4, time >=1.12.2 && <1.13,@@ -69,13 +68,12 @@ -threaded -rtsopts -with-rtsopts=-N build-depends:- aeson >=2.1.2.1 && <2.2,+ aeson >=2.2.3.0 && <2.3, base >=4.7 && <5,- bytestring >=0.11.5.3 && <0.12,+ bytestring >=0.12.1.0 && <0.13, cmdargs >=0.10.22 && <0.11,- directory >=1.3.8.4 && <1.4,- filepath >=1.4.300.1 && <1.5,- filepath-bytestring >=1.4.2.1.13 && <1.5,+ directory >=1.3.8.5 && <1.4,+ filepath >=1.4.301.0 && <1.5, hsftp, libssh2 >=0.2.0.9 && <0.3, mtl >=2.3.1 && <2.4,@@ -103,19 +101,18 @@ -threaded -rtsopts -with-rtsopts=-N build-depends:- aeson >=2.1.2.1 && <2.2,+ aeson >=2.2.3.0 && <2.3, base >=4.7 && <5,- bytestring >=0.11.5.3 && <0.12,+ bytestring >=0.12.1.0 && <0.13, cmdargs >=0.10.22 && <0.11,- directory >=1.3.8.4 && <1.4,- filepath >=1.4.300.1 && <1.5,- filepath-bytestring >=1.4.2.1.13 && <1.5,+ directory >=1.3.8.5 && <1.4,+ filepath >=1.4.301.0 && <1.5, hsftp, libssh2 >=0.2.0.9 && <0.3, mtl >=2.3.1 && <2.4,- tasty >=1.4.3 && <1.5,- tasty-hunit >=0.10.1 && <0.11,- tasty-quickcheck >=0.10.2 && <0.11,+ tasty >=1.5.3 && <1.6,+ tasty-hunit >=0.10.2 && <0.11,+ tasty-quickcheck >=0.11 && <0.12, tasty-smallcheck >=0.8.2 && <0.9, temporary >=1.3 && <1.4, time >=1.12.2 && <1.13,
src/CmdOptions.hs view
@@ -1,7 +1,7 @@ {-| Module : CmdOptions Description : Command-line options.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable
src/Commands.hs view
@@ -1,7 +1,7 @@ {-| Module : Commands Description : Supported commands.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable@@ -33,9 +33,7 @@ getModificationTime, listDirectory, removeFile )-import System.FilePath ( (</>) )-import System.FilePath.ByteString ( encodeFilePath,- isExtensionOf )+import System.FilePath ( isExtensionOf, (</>) ) import Util ( toEpoch ) @@ -52,7 +50,7 @@ liftIO $ withSFTPUser knownHosts user password hostName port $ \sftp -> do allFiles <- sftpListDir sftp transferFrom let byDate x = (toInteger . saMtime . snd) x >= date- byExtension x = null transferExtensions || or [extension `isExtensionOf` fst x | extension <- transferExtensions]+ byExtension x = null transferExtensions || or [extension `isExtensionOf` (C.unpack . fst) x | extension <- transferExtensions] isFile = (== 0o100000) . (.&. 0o170000) . saPermissions . snd files = filter (\x -> byDate x && byExtension x && isFile x) allFiles getFile f = do@@ -71,7 +69,7 @@ upload :: ReaderIO Int upload = do Env{..} <- ask- let byExtension x = null transferExtensions || or [extension `isExtensionOf` encodeFilePath x | extension <- transferExtensions]+ let byExtension x = null transferExtensions || or [extension `isExtensionOf` x | extension <- transferExtensions] byDate = fmap ( (>= date) . toEpoch ) . getModificationTime allFiles <- liftIO $ listDirectory transferFrom >>= filterM ( doesFileExist . (transferFrom </>) ) >>=
src/Config.hs view
@@ -3,7 +3,7 @@ {-| Module : Config Description : Process the YAML configuration file.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable
src/Options.hs view
@@ -4,7 +4,7 @@ {-| Module : Options Description : Holds the options for the hedictl utility.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable
src/Reader.hs view
@@ -1,7 +1,7 @@ {-| Module : Reader Description : Holds environment variables.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable@@ -17,7 +17,6 @@ import Control.Monad.Reader ( ReaderT ) -import qualified Data.ByteString as B -- | Represents the environment configuration for the SFTP client. data Env@@ -35,7 +34,7 @@ -- ^ The source file path for transfer. , transferTo :: FilePath -- ^ The destination file path for transfer.- , transferExtensions :: [B.ByteString]+ , transferExtensions :: [String] -- ^ The list of file extensions to transfer. , archiveTo :: Maybe FilePath -- ^ Optional path to archive transferred files.
src/Util.hs view
@@ -1,7 +1,7 @@ {-| Module : Util Description : Collections of utility functions.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable
test/Spec.hs view
@@ -1,7 +1,7 @@ {-| Module : Main Description : Main entry point for the test suite for SFTP actions.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable
test/TestCommands.hs view
@@ -4,7 +4,7 @@ {-| Module : TestCommands Description : Test functions for SFTP actions.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable@@ -19,22 +19,20 @@ , sftpUploadTests ) where -import Commands ( download, upload )+import Commands ( download, upload ) -import Control.Monad ( filterM )+import Control.Monad ( filterM ) import Control.Monad.Reader -import Reader ( Env (..) )+import Reader ( Env (..) ) -import System.Directory ( createDirectoryIfMissing,- doesFileExist, listDirectory,- removeDirectoryRecursive )-import System.FilePath ( (</>) )-import System.FilePath.ByteString ( encodeFilePath, isExtensionOf )-import System.IO ( hClose, openTempFile )+import System.Directory ( createDirectoryIfMissing, doesFileExist,+ listDirectory,+ removeDirectoryRecursive )+import System.FilePath ( isExtensionOf, (</>) )+import System.IO ( hClose, openTempFile ) -import Test.Tasty ( TestTree, testGroup,- withResource )+import Test.Tasty ( TestTree, testGroup, withResource ) import Test.Tasty.HUnit @@ -116,7 +114,7 @@ [ testCase "Filter by extension" $ do env <- getResource let extensions = ["log"]- byExtension x = null extensions || or [extension `isExtensionOf` encodeFilePath x | extension <- extensions]+ byExtension x = null extensions || or [extension `isExtensionOf` x | extension <- extensions] env' = env { transferFrom = repoLocalDir , transferTo = sftpRemoteDir </> "byext" , transferExtensions = extensions@@ -147,7 +145,7 @@ hClose hArchiveFile let extensions = ["ark"]- byExtension x = null extensions || or [extension `isExtensionOf` encodeFilePath x | extension <- extensions]+ byExtension x = null extensions || or [extension `isExtensionOf` x | extension <- extensions] env' = env { transferFrom = archiveFromDir , transferTo = sftpRemoteDir </> "archive" , archiveTo = Just archiveToDir@@ -179,7 +177,7 @@ , transferTo = testFolder , transferExtensions = extensions }- byExtension x = null extensions || or [extension `isExtensionOf` encodeFilePath x | extension <- extensions]+ byExtension x = null extensions || or [extension `isExtensionOf` x | extension <- extensions] numFiles <- runReaderT download env' allFiles <- listDirectory repoLocalDir >>= filterM ( doesFileExist . (repoLocalDir </>) )
test/TestReader.hs view
@@ -1,7 +1,7 @@ {-| Module : TestReader Description : Test functions for the Reader module.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable
test/TestUtil.hs view
@@ -1,7 +1,7 @@ {-| Module : TestUtil Description : Test functions for the Util module.-Copyright : (c) Maurizio Dusi, 2024+Copyright : (c) IOcrafts, 2024-present License : BSD Maintainer : Maurizio Dusi Stability : stable