packages feed

cr 1.0 → 1.1

raw patch · 3 files changed

+24/−4 lines, 3 filesdep +directorydep +unix

Dependencies added: directory, unix

Files

Cr.hs view
@@ -10,12 +10,14 @@ import Data.Text.Lazy as LT import Shelly import System.Console.CmdArgs+import System.Directory ( doesDirectoryExist ) import System.Exit ( ExitCode, exitFailure ) import System.Environment ( getEnvironment ) import System.IO ( hFlush, stdout ) import System.Process ( StdStream(..)                       , CreateProcess(..), CmdSpec(..), createProcess                       , waitForProcess )+import System.Posix.Directory ( getWorkingDirectory, changeWorkingDirectory ) import Text.Printf ( printf )  default (LT.Text)@@ -87,11 +89,26 @@ shortenCommit :: Commit -> Commit shortenCommit = Prelude.take 7 +cdToRepoRoot :: IO ()+cdToRepoRoot = do+    gitHere <- doesDirectoryExist ".git"+    when (not gitHere) $ do+        wd <- getWorkingDirectory+        if wd == "/"+          then do+              putStrLn "this doesn't look like a git repo"+              exitFailure+          else do+              changeWorkingDirectory ".."+              cdToRepoRoot+ -- FIXME Proper error handling: user should not see git errors. -- FIXME Mercurial support. -- FIXME Add support for reviewing files independently.+-- FIXME Add support for `cr todo`. main :: IO () main = shellyNoDir $ silently $ do+    io cdToRepoRoot     opts <- liftIO $ cmdArgs $ modes crModes     case opts of       Init commit -> do
Makefile view
@@ -1,6 +1,6 @@ all: build -.PHONY: all build dist install clean doc site+.PHONY: all build dist install clean doc site p  build: dist/setup-config 	rm -rf _site _cache@@ -22,3 +22,6 @@  doc: build 	cabal-dev haddock++p:+	permamake.sh *.hs *.cabal Makefile
cr.cabal view
@@ -1,5 +1,5 @@ Name:           cr-Version:        1.0+Version:        1.1 Cabal-Version:  >= 1.8 License:        GPL-3 License-File:   LICENSE@@ -22,7 +22,7 @@   Location:             https://github.com/scvalex/cr.git  Executable cr-  Build-depends:        base >= 4 && < 5, cmdargs, shelly, text,-                        process, transformers+  Build-depends:        base >= 4 && < 5, cmdargs, directory, shelly,+                        text, process, transformers, unix   Main-Is:              Cr.hs   Ghc-options:          -Wall