diff --git a/Justfile b/Justfile index 4c2be41b3..fe81f3455 100644 --- a/Justfile +++ b/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: diff --git a/bin/hledger-script-example-short.hs b/bin/hledger-script-example-short.hs new file mode 100644 index 000000000..09ee18500 --- /dev/null +++ b/bin/hledger-script-example-short.hs @@ -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" + + + +