fuzzytime 0.7.4.1 → 0.7.5
raw patch · 8 files changed
+44/−30 lines, 8 files
Files
- CHANGELOG +3/−0
- INSTALL +1/−1
- README +11/−10
- fuzzytime.cabal +3/−3
- src/FuzzyTime.hs +2/−1
- src/FuzzyTime.hs-boot +1/−0
- src/fuzzytime.1 +5/−2
- src/fuzzytime.hs +18/−13
CHANGELOG view
@@ -6,6 +6,9 @@ read default language from $LANG (hFlush!) daemon? +0.7.5+ added config for alarm sound+ 0.7.4.1 2011.08.01 fixed cabal (thanks Simon Hengel)
INSTALL view
@@ -1,4 +1,4 @@-fuzzytime 0.7.4.1 (2011.08.01)+fuzzytime 0.7.5 (2011.11.28) A clock and timer that tell the time in a more human way (the 'ten past six'-style)
README view
@@ -15,24 +15,25 @@ ### --help A clock and timer that tell the time in a more human way.-v0.7.4.1, 2011.08.01, *antispam*, GPL3++v0.7.5, 2011.11.28, *antispam*, GPL3+ fuzzytime [COMMAND] ... [OPTIONS] Common flags:- -? --help Display help message- -V --version Print version information+ -? --help Display help message+ -V --version Print version information fuzzytime clock [OPTIONS] Print fuzzy time if timer is not set, and countdown if it is. - --caps=INT Capital letters; default 1 (see the man page).- -c --clock=INT 12 or 24-hour clock; default 12-hour.- -l --lang=ITEM Language (currently da, de, el, en, es, fr, it, nb, nl, pl,- se and tr); default en.- -p --prec=INT Precision (1 <= prec <= 60 [minutes]); default 5.- -t --time=ITEM Time to fuzzify as HH:MM; default current time.- -s --style=INT How the time is told (see the man page); default 1.+ -a --caps=INT Capital letters; default 1 (see the man page).+ -c --clock=INT 12 or 24-hour clock; default 12-hour.+ -l --lang=ITEM Language (currently da, de, el, en, es, fr, it, nb, nl,+ pl, se and tr); default en.+ -p --prec=INT Precision (1 <= prec <= 60 [minutes]); default 5.+ -t --time=ITEM Time to fuzzify as HH:MM; default current time.+ -o --sound=ITEM Command to play the alarm sound; see man for the default.+ -s --style=INT How the time is told (see the man page); default 1. fuzzytime timer [OPTIONS] [END] Set timer to END as HH:MM or "unset". (Disables printing time.)
fuzzytime.cabal view
@@ -1,12 +1,12 @@ name: fuzzytime-version: 0.7.4.1+version: 0.7.5 description: A clock and timer that tell the time in a more human way (the 'ten past six' style) synopsis: A 'ten past six' style clock category: Utils license: GPL license-file: LICENSE author: Kamil Stachowski-maintainer: kamil.stachowski@gmail.com+maintainer: kamil (a full stop) stachowski (an at sign) gmail (a full stop) com build-type: Simple stability: Experimental cabal-version: >=1.8@@ -41,4 +41,4 @@ source-repository this type: git location: https://github.com/caminoix/fuzzytime- tag: 0.7.4.1+ tag: 0.7.5
src/FuzzyTime.hs view
@@ -91,7 +91,7 @@ -- In the timer mode, only language and left minutes need to be set. toFuzzyTime :: FuzzyTimeConf -> FuzzyTime toFuzzyTime ftc = case ftc of- (ClockConf caps clock lang prec time style)+ (ClockConf caps clock lang prec time sound style) -> FuzzyClock am caps clock fuzzdHour lang fuzzdMin style where fuzzdHour :: Int@@ -177,6 +177,7 @@ , lang :: String , prec :: Int , time :: Time+ , sound :: String , style :: Int } | TimerConf {
src/FuzzyTime.hs-boot view
@@ -46,6 +46,7 @@ , lang :: String , prec :: Int , time :: Time+ , sound :: String , style :: Int } | TimerConf {
src/fuzzytime.1 view
@@ -1,4 +1,4 @@-.TH fuzzytime 1 "April 26, 2011" "version 0.7.4.1" "A fuzzy clock and timer"+.TH fuzzytime 1 "November 28, 2011" "version 0.7.5" "A fuzzy clock and timer" .\" ------------------------------------------------------------------------------------- @@ -38,7 +38,7 @@ .SS Clock mode (print the time) .TP- \--caps+\-a \--caps Capital letters; should be between 0 and 3; the default is one. Does not affect timer. 0: all lowercase; 1: default for the lang; 2: Title Case; 3: ALL CAPS. .TP@@ -53,6 +53,9 @@ .TP \-t \--time Time to fuzzify as HH:MM; the default is the current time. Affects timer.+.TP+\-o \--sound+Command to play the alarm sound; the default is "aplay /usr/share/fuzzytime/sound.wav &> /dev/null" to reduce the dependencies. .TP \-s \--style How the time is told; see below; the default is 1. Does not affect timer.
src/fuzzytime.hs view
@@ -80,6 +80,10 @@ confDefClockPrec :: Int confDefClockPrec = 5 +-- | \[config] The default command for playing the timer sound.+confDefClockSound :: String+confDefClockSound = "aplay /usr/share/fuzzytime/sound.wav &> /dev/null"+ -- | \[config] The default style for the clock mode (see the man page). confDefClockStyle :: Int confDefClockStyle = 1@@ -91,12 +95,13 @@ nowClock <- getClockTime let nowString = take 5 . drop 11 $ show nowClock return $ ClockConf {- caps = confDefClockCaps &= help confHelpClockCaps+ caps = confDefClockCaps &= help confHelpClockCaps &= name "a" , clock = confDefClockClock &= help confHelpClockClock &= name "c" , lang = confDefLang &= help confHelpClockLang , prec = confDefClockPrec &= help confHelpClockPrec , time = nowString &= help confHelpClockTime- , style = confDefClockStyle &= help confHelpClockStyle+ , sound = confDefClockSound &= help confHelpClockSound &= name "o"+ , style = confDefClockStyle &= help confHelpClockStyle &= name "s" } &= name "clock" &= help confHelpClock -- | \[config] Get the default config for either showing the time or setting the timer.@@ -123,11 +128,6 @@ return $ home ++ "/.fuzzytimer" --- | \[config] The default command for playing the timer sound.-confTimerSoundCmd :: String-confTimerSoundCmd = "aplay /usr/share/fuzzytime/sound.wav &> /dev/null"-- -- | Print nicely what languages are available. showAvailLangs :: String -> String showAvailLangs i = case length confAvailLangs of@@ -163,6 +163,10 @@ confHelpClockTime :: String confHelpClockTime = "Time to fuzzify as HH:MM; default current time." +-- | \[config] Help message for --sound.+confHelpClockSound :: String+confHelpClockSound = "Command to play the alarm sound; see man for the default."+ -- | \[config] Help message for --style. confHelpClockStyle :: String confHelpClockStyle = "How the time is told (see the man page); default " ++ show confDefClockStyle ++ "."@@ -179,7 +183,7 @@ -- | \[config] Help message for summary confHelpSummary :: String-confHelpSummary = "A clock and timer that tell the time in a more human way.\nv0.7.4.1, 2011.04.26, kamil.stachowski@gmail.com, GPL3+"+confHelpSummary = "A clock and timer that tell the time in a more human way.\nv0.7.5, 2011.11.28, kamil.stachowski@gmail.com, GPL3+" -- check --------------------------------------------------------------------------------------------------------------------------------------------------------------------------@@ -188,12 +192,13 @@ -- | \[config] Check that arguments given at cli or read from the timer file are correct. checkFTConf :: FuzzyTimeConf -> Either String FuzzyTimeConf -checkFTConf c@(ClockConf caps clock lang prec time style)+checkFTConf c@(ClockConf caps clock lang prec time sound style) | caps < 0 || caps > 3 = Left "--caps must be in [0..3] (see the man page)." | clock `notElem` [12, 24] = Left "--clock must be either 12 or 24." | lang `notElem` confAvailLangs = Left ("--lang must be " ++ showAvailLangs "or" ++ ".") | prec < 1 || prec > 60 = Left "--prec must be in [1..60]." | not (checkTimeOk time) = Left "--time must be given as HH:MM, where HH is in [0..23] and MM is in [0..59]."+ | sound == "" = Left "--sound cannot be empty." | style < 1 || style > 3 = Left "--style must be in [1..3] (see the man page)." | otherwise = Right c @@ -236,14 +241,14 @@ timerConf <- getDefTimerConf conf <- cmdArgs (modes [clockConf, timerConf] &= program confHelpProgram &= summary confHelpSummary) case conf of- (ClockConf _ _ _ _ _ _) -> runModeShow $ if end timerConf == "empty" then+ (ClockConf _ _ _ _ _ _ _) -> runModeShow $ if end timerConf == "empty" then conf else timerConf { lang = lang conf, now = time conf }- tc@(TimerConf _ _ _) -> runModeTimer tc+ tc@(TimerConf _ _ _) -> runModeTimer tc -- modes --------------------------------------------------------------------------------------------------------------------------------------------------------------------------@@ -256,7 +261,7 @@ Left e -> exitWithError e Right c -> do let ftime = toFuzzyTime c- when (isTimerZero ftime) (do _ <- system confTimerSoundCmd; return ())+ when (isTimerZero ftime) (do _ <- system (sound conf); return ()) print ftime @@ -273,4 +278,4 @@ else do writeFile path end putStrLn $ "Timer has been set to " ++ end ++ "."-runModeTimer (ClockConf _ _ _ _ _ _) = exitWithError "The timer mode shouldn't have been given a ClockConf."+runModeTimer (ClockConf _ _ _ _ _ _ _) = exitWithError "The timer mode shouldn't have been given a ClockConf."