summaryrefslogtreecommitdiff
path: root/Biz/Cli.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-05-01 23:41:47 -0400
committerBen Sima <ben@bsima.me>2024-05-09 21:38:52 -0400
commitdd0bc9610cf0e6842f5d5ac67a73f2fd6f4eba2f (patch)
tree2a208df1e505bbafca1382cdd2ceb27a5185a6ee /Biz/Cli.hs
parent2fac80aa1727a200f576f899bb325f523842c3ff (diff)
Improve Haskell documentation and bild test
Added docs to core libraries and expanded the Example.hs test to test for all the things I want to support in a build.
Diffstat (limited to 'Biz/Cli.hs')
-rw-r--r--Biz/Cli.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/Biz/Cli.hs b/Biz/Cli.hs
index 5029792..c524332 100644
--- a/Biz/Cli.hs
+++ b/Biz/Cli.hs
@@ -25,13 +25,24 @@ import qualified Biz.Test as Test
import qualified System.Console.Docopt as Docopt
import qualified System.Environment as Environment
+-- | Plan is the main data structure that describes a CLI program. It's not the
+-- best name, but it works. This type is parameterized with `cfg` so you can
+-- load configuration from the environment and pass it into your Plan.
data Plan cfg = Plan
- { help :: Docopt.Docopt,
+ { -- | Usage info, shows when given --help
+ help :: Docopt.Docopt,
+ -- | The main function takes arguments and produces effects. Maybe it should
+ -- also take `cfg` as an argument?
move :: Docopt.Arguments -> IO (),
+ -- | The test suite for the gram, invoked when 'test' is passed as the first
+ -- argument to the program
test :: Test.Tree,
+ -- | Function for cleaning up any files or resources, presumably on
+ -- shutdown. Can be just `pure` if you have nothing to tidy.
tidy :: cfg -> IO ()
}
+-- | The entrypoint for CLI programs, use this in your own `main`.
main :: Plan cfg -> IO ()
main Plan {..} =
Environment.getArgs