Skip to content

Commit 8f4eba5

Browse files
committed
Merge pull request pcapriotti#418
2 parents bfe5aca + 094435b commit 8f4eba5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -527,22 +527,6 @@ functions, each with its own set of options, and possibly some
527527
global options that apply to all of them. Typical examples are
528528
version 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-
546530
Note that all the parsers appearing in a command need to have the
547531
same type. For this reason, it is often best to use a sum type
548532
which 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+
562562
Alternatively, you can directly return an `IO` action from a parser,
563563
and execute it using `join` from `Control.Monad`.
564564

0 commit comments

Comments
 (0)