orgstat 0.1.6 → 0.1.7
raw patch · 5 files changed
+27/−15 lines, 5 filesdep ~orgmode-parsedep ~universum
Dependency ranges changed: orgmode-parse, universum
Files
- CHANGES.md +8/−2
- orgstat.cabal +3/−3
- src/OrgStat/Config.hs +3/−2
- src/OrgStat/Outputs/Script.hs +4/−1
- src/OrgStat/Outputs/Types.hs +9/−7
CHANGES.md view
@@ -1,3 +1,9 @@+0.1.7+==========+* Switch "script" output interpreter from "sh" to "/bin/env sh".+* Update universum and orgmode-parse version (includes+ https://github.com/ixmatus/orgmode-parse/pull/53)+ 0.1.6 ========== * Support "or" tags -- now it's possible to specify "t1 | t2 | t3" as a modifier by@@ -7,8 +13,8 @@ * Added new output type -- script output. * Improved documentation, in particular in the orgstatExample.yaml. * Breaking: Configuration changes:- * Simplifed the configuration, now there's only one default timeline config,- which cannot be overriden on a per-output basis.+ * Simplified the configuration, now there's only one default timeline config,+ which cannot be overridden on a per-output basis. * Config parameter `colorSalt` was removed, use `timelineDefault.colorSalt` instead. * Timeline default color is now white. * timelineDefault renamed into timelineParams.
orgstat.cabal view
@@ -1,5 +1,5 @@ name: orgstat-version: 0.1.6+version: 0.1.7 synopsis: Statistics visualizer for org-mode license: GPL-3 license-file: LICENSE@@ -50,12 +50,12 @@ , lens >= 4.14 , mtl >= 2.2.1 , optparse-simple- , orgmode-parse >= 0.2.1 && < 0.3+ , orgmode-parse >= 0.2.3 && < 0.3 , process >= 1.6.3.0 , text >= 1.2.2.1 , time >= 1.6.0.1 , turtle >= 1.2.8- , universum >= 1.4.0+ , universum >= 1.5.0 , yaml >= 0.8.21.1 hs-source-dirs: src default-language: Haskell2010
src/OrgStat/Config.hs view
@@ -45,8 +45,8 @@ data ConfRange = ConfFromTo !ConfDate !ConfDate- | ConfBlockWeek !Integer | ConfBlockDay !Integer+ | ConfBlockWeek !Integer | ConfBlockMonth !Integer deriving (Show) @@ -159,7 +159,8 @@ fmap Left (o .: "scriptPath") <|> fmap Right (o .: "inline") spReports <- o .: "reports"- pure $ ScriptOutput $ ScriptParams spScript spReports+ spInterpreter <- o .:? "interpreter" .!= "sh"+ pure $ ScriptOutput $ ScriptParams spScript spReports spInterpreter (String "block") -> do boReport <- o .: "report" _bpMaxLength <- o .:? "maxLength" .!= 80
src/OrgStat/Outputs/Script.hs view
@@ -15,6 +15,7 @@ import OrgStat.Ast (filterHasClock, orgTotalDuration) import OrgStat.Config (confReports, crName) import OrgStat.Helpers (resolveReport)+import OrgStat.Logging import OrgStat.Outputs.Types (ScriptParams (..)) import OrgStat.Util (timeF) import OrgStat.WorkMonad (WorkM, wcConfig)@@ -31,6 +32,7 @@ -- Set env variables prevVars <- forM allReports $ \(toString -> reportName,org) -> do let duration = timeF $ orgTotalDuration $ filterHasClock org+ logDebug $ "Variable " <> show reportName <> " duration is " <> show duration (prevVar :: Maybe String) <- liftIO $ lookupEnv reportName liftIO $ setEnv reportName (toString duration) pure $ (reportName,) <$> prevVar@@ -40,7 +42,8 @@ -- Execute script let cmdArgument = either id (\t -> "-c \"" <> toString t <> "\"") spScript liftIO $ callCommand $- "sh " <> cmdArgument+ spInterpreter <> " " <> cmdArgument+ --"/bin/env sh " <> cmdArgument -- Restore the old variables, clean new. forM_ (map fst allReports) $ \(toString -> reportName) -> do
src/OrgStat/Outputs/Types.hs view
@@ -23,13 +23,13 @@ , BlockOutput (..) ) where -import Universum+import Universum -import Control.Lens (makeLenses)+import Control.Lens (makeLenses) -import Data.Default (Default (..))-import Diagrams.Backend.SVG (B)-import qualified Diagrams.Prelude as D+import Data.Default (Default (..))+import Diagrams.Backend.SVG (B)+import qualified Diagrams.Prelude as D ---------------------------------------------------------------------------- -- Timeline@@ -75,10 +75,12 @@ -- | Parameters of the summary output data ScriptParams = ScriptParams- { spScript :: !(Either FilePath Text)+ { spScript :: !(Either FilePath Text) -- ^ Either path to the script to execute, or a script text itself.- , spReports :: ![Text]+ , spReports :: ![Text] -- ^ Reports to consider.+ , spInterpreter :: !String+ -- ^ Interpreter to use. } deriving Show ----------------------------------------------------------------------------