@@ -527,22 +527,6 @@ functions, each with its own set of options, and possibly some
527527global options that apply to all of them. Typical examples are
528528version control systems like ` git ` , or build tools like ` cabal ` .
529529
530- A command can be created using the ` subparser ` builder (or ` hsubparser ` ,
531- which is identical but for an additional ` --help ` option on each
532- command), and commands can be added with the ` command ` modifier.
533- For example
534-
535- ``` haskell
536- subparser
537- ( command " add" (info addOptions ( progDesc " Add a file to the repository" ))
538- <> command " commit" (info commitOptions ( progDesc " Record changes to the repository" ))
539- )
540- ```
541-
542- Each command takes a full ` ParserInfo ` structure, which will be
543- used to extract a description for this command when generating a
544- help text.
545-
546530Note that all the parsers appearing in a command need to have the
547531same type. For this reason, it is often best to use a sum type
548532which has the same structure as the command itself. For example,
@@ -559,6 +543,22 @@ data Command
559543 ...
560544```
561545
546+ A command can then be created using the `subparser` builder (or
547+ `hsubparser` , which is identical but for an additional `-- help` option
548+ on each command), and commands can be added with the `command`
549+ modifier. For example,
550+
551+ ```haskell
552+ subparser
553+ ( command " add" (info addCommand ( progDesc " Add a file to the repository" ))
554+ <> command " commit" (info commitCommand ( progDesc " Record changes to the repository" ))
555+ )
556+ ```
557+
558+ Each command takes a full ` ParserInfo ` structure, which will be
559+ used to extract a description for this command when generating a
560+ help text.
561+
562562Alternatively, you can directly return an ` IO ` action from a parser,
563563and execute it using ` join ` from ` Control.Monad ` .
564564
0 commit comments