summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshikuniJujo <>2009-06-15 00:15:32 (GMT)
committerLuite Stegeman <luite@luite.com>2009-06-15 00:15:32 (GMT)
commitfb6a25dc6707fc25bb5f43da9288d71e0c68419f (patch)
tree501865ead1761c6ca55e97761d93ac1177c8e694
parente682159628d8c257073147af923d1e2876593873 (diff)
version 0.3.6.20.3.6.2
-rw-r--r--Network/CommandList.hs1
-rw-r--r--Network/Console.hs7
-rw-r--r--yjftp.cabal2
-rw-r--r--yjftp.hs4
4 files changed, 8 insertions, 6 deletions
diff --git a/Network/CommandList.hs b/Network/CommandList.hs
index 21c6abb..213ee6e 100644
--- a/Network/CommandList.hs
+++ b/Network/CommandList.hs
@@ -216,4 +216,5 @@ myNlst h str = do
mkRet ('d':rest) = last (words rest) ++ "/"
mkRet ('-':rest) = last (words rest)
mkRet ('l':rest) = last (words rest)
+ mkRet ('c':rest) = last (words rest)
mkRet _ = error "myNlst error"
diff --git a/Network/Console.hs b/Network/Console.hs
index 7bfaaef..5f3633a 100644
--- a/Network/Console.hs
+++ b/Network/Console.hs
@@ -22,7 +22,7 @@ import System.Console.Haskeline
import Prelude hiding (catch)
import Control.Monad.Trans
import System.IO
-import Data.List (isPrefixOf)
+import Data.List (isPrefixOf, isSuffixOf)
import Control.Exception hiding (catch)
import Data.Char (isSpace)
@@ -46,7 +46,8 @@ compHFlush = lift . hFlush
mkComp :: (String -> IO [ String ]) -> Comp
mkComp f = Comp $ \(rts,_) -> do
ss <-f $ reverse rts
- return (dropWhile (not.isSpace) rts, map (\s -> Completion s s True) ss)
+ return (dropWhile (not.isSpace) rts, map (\s -> Completion s s $ notIsDir s) ss)
+ where notIsDir fp = not $ isSuffixOf "/" fp
{-
mkComp f = Comp $ completeWord Nothing " " $
\str -> fmap (map (\s -> Completion s s True)) $ f str
@@ -66,7 +67,7 @@ readConsole = getInputLine
compFilename :: String -> IO [ String ]
compFilename inp = do
- fs <- fmap (map replacement) $ listFiles "./"
+ fs <- fmap (map replacement) $ listFiles inp
return $ filter (isPrefixOf inp) fs
compPrint :: Show a => a -> CompIO ()
diff --git a/yjftp.cabal b/yjftp.cabal
index 6089c8a..95d63fd 100644
--- a/yjftp.cabal
+++ b/yjftp.cabal
@@ -1,5 +1,5 @@
Name: yjftp
-Version: 0.3.6.1
+Version: 0.3.6.2
License: GPL
License-file: LICENSE
Author: Yoshikuni Jujo
diff --git a/yjftp.hs b/yjftp.hs
index 1fae67a..1ca7d23 100644
--- a/yjftp.hs
+++ b/yjftp.hs
@@ -16,8 +16,8 @@ myCommandList = [
"list directory contents\n\toption -l list detail of contents",
compLs))
, ("cd", (changeDirectoryFTP, "change directory in remote", compRemoteFile))
- , ("lcd", (changeDirectoryLocal, "change directory in local", const filenameCompletionFunction))
- , ("put", (putFileFTP, "upload file", const filenameCompletionFunction))
+ , ("lcd", (changeDirectoryLocal, "change directory in local", const compFilename))
+ , ("put", (putFileFTP, "upload file", const compFilename))
, ("get", (getFileFTP, "download file", compRemoteFile))
, ("cat", (showFileFTP, "show remote file", compRemoteFile))
, ("rm", (removeFileFTP, "delete remote file", compRemoteFile))