;bin: hledger-script-example: add a short low boilerplace version

This commit is contained in:
Simon Michael 2024-12-16 15:29:18 -10:00
parent d20d2571f8
commit 37ac52aa7e
2 changed files with 37 additions and 0 deletions

View File

@ -980,6 +980,10 @@ log-headtail *COLOR:
log-push:
scp -v doc/log*.txt 173.255.213.235:/opt/hledger/site/out
# Update the short version of the hledger script example (by removing docs).
bin-short:
awk '/^----/ { b=!b; next } !b' bin/hledger-script-example.hs | rg -v '^ *-- \w' > bin/hledger-script-example-short.hs
# ** News ------------------------------------------------------------
NEWS:

View File

@ -0,0 +1,33 @@
#!/usr/bin/env stack
-- stack runghc --package hledger
{-
script-example - my new script
-}
{-# LANGUAGE OverloadedStrings #-}
import Hledger.Cli.Script
import qualified Data.Text as T
import qualified Data.Text.IO as T
cmdmode = hledgerCommandMode (unlines
---------------------------standard terminal width-----------------------------
["script-example"
,"Usage: hledger-script-example [OPTS] [ARGS]"
,"or: hledger script-example -- [OPTS] [ARGS]"
,"Examples:"
,"$ hledger-script-example # do the thing"
,"$ hledger-script-example --help # print help"
])
[] [generalflagsgroup1] [] ([], Just $ argsFlag "[ARGS]")
main = do
opts@CliOpts{reportspec_=rspec} <- getHledgerCliOpts cmdmode
withJournalDo opts $ \j -> do
putStrLn "hello"