forest-fire 0.2 → 0.2.1
raw patch · 2 files changed
+27/−16 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- app/Main.hs +26/−15
- forest-fire.cabal +1/−1
app/Main.hs view
@@ -1,30 +1,41 @@ module Main where import Lib++import Paths_forest_fire (version)+import Data.Version (showVersion) import Console.Options import System.IO+import System.Exit+import Data.Monoid ((<>), mappend) main :: IO () main = defaultMain $ do programName "forest-fire"- programDescription "Recursively delete CFn dependencies"- flagA <- flag $ FlagLong "delete"+ programDescription $ descr ++ usage+ programVersion version+ flagH <- flag $ FlagShort 'h' <> FlagLong "help" <> FlagDescription " Print this usage information and quit."+ flagV <- flag $ FlagShort 'v' <> FlagLong "version" <> FlagDescription "Print version info and quit."+ flagA <- flag $ FlagShort 'd' <> FlagLong "delete" <> FlagDescription " Actually perform the deletion (dry-run by default)." allArgs <- remainingArguments "FILE" action $ \toParam -> do hSetBuffering stdout LineBuffering -- or even NoBuffering+ let showVersion = toParam flagV let reallyDelete = toParam flagA let stackName = toParam allArgs- case stackName of- [s] -> if reallyDelete- then actuallyDoTheDelete s- else showDeletionPlan s- _ -> printUsage+ case showVersion of+ True -> printVersion+ False -> case stackName of+ [s] -> if reallyDelete+ then actuallyDoTheDelete s+ else showDeletionPlan s+ _ -> do putStrLn "[ERROR] Please specify one stack name."+ putStrLn usage+ exitFailure -printUsage = do- putStrLn "\nforest-fire"- putStrLn "-----------\n"- putStrLn "Usage:\n"- putStrLn " forest-fire <stackname> [--delete]\n"- putStrLn "Flags:\n"- putStrLn "--delete To actually perform the deletion."- putStrLn ""+printVersion = do+ putStrLn $ "forest-fire v" ++ showVersion version++descr = "Recursively find and delete CFn dependencies!\n\n"+usage = "usage: forest-fire <stackname> [--delete]\n" +++ "or: forest-fire --help"
forest-fire.cabal view
@@ -1,5 +1,5 @@ name: forest-fire-version: 0.2+version: 0.2.1 synopsis: Recursively delete CloudFormation stacks and their dependants description: This simple tool will repeatedly query CloudFormation