summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/CoreCommon.hs
diff options
context:
space:
mode:
authorJuraj Hercek <juhe_haskell@hck.sk>2007-12-23 00:14:19 +0100
committerJuraj Hercek <juhe_haskell@hck.sk>2007-12-23 00:14:19 +0100
commit81a2809683ceda6475d6d42df644dce102dd290b (patch)
tree1253d1e659cde402e22f5608426de9d6f7fe80fd /Plugins/Monitors/CoreCommon.hs
parent112d0191be18b474c750664f683e17c9e919d020 (diff)
downloadxmobar-81a2809683ceda6475d6d42df644dce102dd290b.tar.gz
xmobar-81a2809683ceda6475d6d42df644dce102dd290b.tar.bz2
Added documentation.
- added Thermal, CoreTemp, CpuFreq documentation to README file - added haddock documentation darcs-hash:20071222231419-f49a6-beadaa214bd80a9eb12f568dbff8dcf0d88ecfe7.gz
Diffstat (limited to 'Plugins/Monitors/CoreCommon.hs')
-rw-r--r--Plugins/Monitors/CoreCommon.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Plugins/Monitors/CoreCommon.hs b/Plugins/Monitors/CoreCommon.hs
index de737d4..9a19cd5 100644
--- a/Plugins/Monitors/CoreCommon.hs
+++ b/Plugins/Monitors/CoreCommon.hs
@@ -18,6 +18,10 @@ import Plugins.Monitors.Common
import System.Posix.Files (fileExist)
import System.Directory
+-- |
+-- Function checks the existence of first file specified by pattern and if the
+-- file doesn't exists failure message is shown, otherwise the data retrieval
+-- is performed.
checkedDataRetrieval :: String -> String -> String -> String -> Double -> Monitor String
checkedDataRetrieval failureMessage dir file pattern divisor = do
exists <- io $ fileExist $ foldl (++) dir ["/", pattern, "0/", file]
@@ -25,6 +29,10 @@ checkedDataRetrieval failureMessage dir file pattern divisor = do
False -> return failureMessage
True -> retrieveData dir file pattern divisor
+-- |
+-- Function retrieves data from files in directory dir specified by pattern.
+-- String values are converted to double and adjusted with divisor. Final array
+-- is processed by template parser function and returned as monitor string.
retrieveData :: String -> String -> String -> Double -> Monitor String
retrieveData dir file pattern divisor = do
count <- io $ dirCount dir pattern