diff options
author | Joey Hess <joey@kitenet.net> | 2010-12-30 16:52:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-12-30 16:52:24 -0400 |
commit | 7a52b34e0631609d5d862c3ba100cc499b30b5fa (patch) | |
tree | 378440e7746ee941f1f777f0c23862d71e4693fe /git-annex-shell.hs | |
parent | 88ff9e82fc3dcb653b2a116f1c162d98a1f6bdcf (diff) |
add git-annex-shell command
This is not yet complete, as it does not allow starting rsync or scp.
Diffstat (limited to 'git-annex-shell.hs')
-rw-r--r-- | git-annex-shell.hs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/git-annex-shell.hs b/git-annex-shell.hs new file mode 100644 index 000000000..7adb5e790 --- /dev/null +++ b/git-annex-shell.hs @@ -0,0 +1,52 @@ +{- git-annex-shell main program + - + - Copyright 2010 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +import System.Console.GetOpt +import System.Environment +import Control.Monad (when) + +import CmdLine +import Command +import Utility +import Options + +import qualified Command.FromKey +import qualified Command.DropKey +import qualified Command.SetKey + +cmds :: [Command] +cmds = concat + [ Command.FromKey.command + , Command.DropKey.command + , Command.SetKey.command + ] + +options :: [Option] +options = [ Option ['c'] ["command"] (NoArg (storeOptBool "command" True)) + "ignored for compatability with git-shell" + ] ++ commonOptions + +header :: String +header = "Usage:\n" ++ + "\tgit-annex-shell -c git-annex command [option ..]\n" ++ + "\tgit-annex-shell -c shellcommand argument" + +main :: IO () +main = do + args <- getArgs + -- dispatch git-annex commands to builtin versions, + -- and pass everything else to git-shell + case args of + ("git-annex":as) -> builtin as + [] -> builtin [] + _ -> external args + where + builtin l = dispatch l cmds options header + external l = do + ret <- boolSystem "git-shell" l + when (not ret) $ + error "git-shell failed" |