module Main where import Network.Yjftp myCommandList :: CommandList myCommandList = [ ("?", helpFTP) , ("q", quitFTP) , ("quit", quitFTP) , ("exit", quitFTP) , ("bye", quitFTP) , ("!", systemFTP) , ("pwd", pwdFTP) , ("ls", \h args -> case args of ("-l":args_) -> directoryFTP h args_ _ -> listFTP h args) , ("cd", changeDirectoryFTP) , ("lcd", changeDirectoryLocal) , ("put", putFileFTP) , ("get", getFileFTP) , ("cat", showFileFTP) , ("rm", removeFileFTP) , ("mkdir", makeDirectoryFTP) , ("rmdir", removeDirectoryFTP) , ("mv", moveFileFTP) , ("cp", copyFileFTP) , ("edit", editBy $ \fn -> do edt <- catch (getEnv "EDITOR") (const $ return "vi") return $ edt ++ " " ++ fn) , ("show", readBy $ \fn -> do pgr <- catch (getEnv "PAGER") (const $ return "less") return $ pgr ++ " " ++ fn) ] main :: IO () main = runYjftp myCommandList