mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-12 19:08:34 +03:00
32ccbba805
env -S isn't a thing on linux of course. Go back to using standard env, which means using a stack options line, which means not using "ghc". This new setup is probably simpler anyway. I've just had to give up on the goal of having each script's required packages being defined in one place; now (to they extent they are required) they must be defined both in the script header and in compile.sh.
36 lines
950 B
Haskell
Executable File
36 lines
950 B
Haskell
Executable File
#!/usr/bin/env stack
|
|
-- stack runghc --verbosity info --package hledger
|
|
-- See hledger-check-fancyassertions.hs
|
|
|
|
{-
|
|
hledger-check-tagfiles stack script.
|
|
Read the default journal and give an error if any tag values
|
|
containing '/' do not exist as file paths.
|
|
Usage:
|
|
|
|
$ hledger-check-tagfiles.hs # compiles if needed
|
|
|
|
or:
|
|
|
|
$ hledger check-tagfiles # compiles if there's no compiled version
|
|
-}
|
|
|
|
import Control.Monad
|
|
import qualified Data.Text as T
|
|
import Hledger.Cli
|
|
import System.Directory
|
|
import System.Exit
|
|
|
|
main = withJournalDo defcliopts $ \j -> do
|
|
let filetags = [ (t,v)
|
|
| (t',v') <- concatMap transactionAllTags $ jtxns j
|
|
, let t = T.unpack t'
|
|
, let v = T.unpack v'
|
|
, '/' `elem` v
|
|
]
|
|
forM_ filetags $ \(t,f) -> do
|
|
exists <- doesFileExist f
|
|
when (not exists) $ do
|
|
putStrLn $ "file not found in tag: " ++ t ++ ": " ++ f
|
|
exitFailure
|