aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-09-01 21:06:45 +0200
committerIgor Pashev <pashev.igor@gmail.com>2019-09-01 21:06:45 +0200
commit72480d98aff91590f11adee8ea0501ba7c490764 (patch)
tree4222d25121fee050bfe797643d0fea6e8dde6f43 /src
parent54578195f556ea478cd2cffc948157c91b8bef13 (diff)
downloadfrotate.hs-72480d98aff91590f11adee8ea0501ba7c490764.tar.gz
Exit with error if --keep and --delete are missed
Still print all days to stderr. This is to prevent misuse when frotate is invoked without --keep or --delete.
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 0f66daa..09aeb99 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -2,6 +2,7 @@ module Main
( main
) where
+import System.Exit (exitFailure)
import System.IO (hPutStrLn, stderr)
import Data.Time.Calendar (Day)
@@ -64,4 +65,6 @@ main = do
putStrLn $ unwords . map show . concatMap (take 1 . reverse) $ groups
Just Delete ->
putStrLn $ unwords . map show . concatMap (drop 1 . reverse) $ groups
- Nothing -> mapM_ (hPutStrLn stderr . unwords . map show . reverse) groups
+ Nothing -> do
+ mapM_ (hPutStrLn stderr . unwords . map show . reverse) groups
+ exitFailure