;bin: hledger-script-example: add a short low boilerplace version
This commit is contained in:
parent
d20d2571f8
commit
37ac52aa7e
4
Justfile
4
Justfile
@ -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:
|
||||
|
||||
|
||||
33
bin/hledger-script-example-short.hs
Normal file
33
bin/hledger-script-example-short.hs
Normal 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"
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user