diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2008-02-29 10:50:14 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2008-02-29 10:50:14 +0100 |
commit | e3b7ad1d4eb46dbd44916b323fe793adae1cd721 (patch) | |
tree | 42638f19729251fda1b00c04b17012ad51e2fd0f /XMonad/Prompt | |
parent | 7fd4c6e5b96a0340eb4aa7601992e71ba0034af5 (diff) | |
download | XMonadContrib-e3b7ad1d4eb46dbd44916b323fe793adae1cd721.tar.gz XMonadContrib-e3b7ad1d4eb46dbd44916b323fe793adae1cd721.tar.xz XMonadContrib-e3b7ad1d4eb46dbd44916b323fe793adae1cd721.zip |
Ssh: complete known hosts with non standard ports too
darcs-hash:20080229095014-32816-be85541c5f65ba9467d327ec3e305c961811678b.gz
Diffstat (limited to 'XMonad/Prompt')
-rw-r--r-- | XMonad/Prompt/Ssh.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/XMonad/Prompt/Ssh.hs b/XMonad/Prompt/Ssh.hs index 379de4c..a7c392f 100644 --- a/XMonad/Prompt/Ssh.hs +++ b/XMonad/Prompt/Ssh.hs @@ -48,7 +48,9 @@ import Data.Maybe data Ssh = Ssh instance XPrompt Ssh where - showXPrompt Ssh = "SSH to: " + showXPrompt Ssh = "SSH to: " + commandToComplete _ c = c + nextCompletion _ = getNextCompletion sshPrompt :: XPConfig -> X () sshPrompt c = do @@ -88,7 +90,7 @@ sshComplListFile kh = do sshComplListFile' :: String -> IO [String] sshComplListFile' kh = do l <- readFile kh - return $ map (takeWhile (/= ',') . concat . take 1 . words) + return $ map (getWithPort . takeWhile (/= ',') . concat . take 1 . words) $ filter nonComment $ lines l @@ -103,3 +105,11 @@ nonComment [] = False nonComment ('#':_) = False nonComment ('|':_) = False -- hashed, undecodeable nonComment _ = True + +getWithPort :: String -> String +getWithPort ('[':str) = host ++ " -p " ++ port + where (host,p) = break (==']') str + port = case p of + ']':':':x -> x + _ -> "22" +getWithPort str = str |