gitignore 1.0.1 → 1.1
raw patch · 2 files changed
+14/−11 lines, 2 filesdep ~aeson
Dependency ranges changed: aeson
Files
- gitignore.cabal +2/−2
- gitignore.hs +12/−9
gitignore.cabal view
@@ -1,5 +1,5 @@ name: gitignore-version: 1.0.1+version: 1.1 synopsis: Apply GitHub .gitignore templates to already existing repositories. description: Apply GitHub .gitignore templates to already existing repositories. homepage: https://github.com/relrod/gitignore@@ -18,7 +18,7 @@ executable gitignore main-is: gitignore.hs- build-depends: aeson >= 0.8 && < 0.9,+ build-depends: aeson >= 0.8 && < 1, base >= 4 && < 5, base64-bytestring >= 1 && < 2, bytestring >= 0.10 && < 1,
gitignore.hs view
@@ -3,6 +3,7 @@ module Main where import Control.Applicative+import Control.Monad (forM_) import Data.Aeson import Data.Char (toLower) import Data.List (dropWhileEnd, find, sort)@@ -78,12 +79,14 @@ filter ((/= "") . Main.path) $ fmap (\x -> x { Main.path = dropWhileEnd (/= '.') (Main.path x) }) x case s of- "list" ->- mapM_ putStrLn $ sort $ fmap path ignores- _ -> do- let selected = find (\y -> fmap toLower (Main.path y) == s) ignores- case selected of- Nothing -> error "No such gitignore was found. Use 'list' for all possible gitignores."- Just f -> do- decoded <- getIgnoreFile $ url f- putStr $ C8.unpack decoded+ "list" -> mapM_ putStrLn $ sort $ fmap path ignores+ _ -> forM_ a (printIgnore ignores)++printIgnore :: Foldable t => t GitIgnore -> [Char] -> IO ()+printIgnore ignores s = do+ let selected = find (\y -> fmap toLower (Main.path y) == s) ignores+ case selected of+ Nothing -> error "No such gitignore was found. Use 'list' for all possible gitignores."+ Just f -> do+ decoded <- getIgnoreFile $ url f+ putStr $ C8.unpack decoded