diff options
Diffstat (limited to 'Biz/Cli.hs')
-rw-r--r-- | Biz/Cli.hs | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 |