elpMsg :: ExecParams -> Pretty.Doc (Result Pretty.AnsiStyle)
helpMsg ExecParams{protocol = Params{name, subcommand}} = Pretty.vsep
    [ Pretty.reflow "Execute a command with predefined environment and command\
        \ line options."
    , ""

    , Help.usageSection name
        [ subcommand'
            <+> Pretty.brackets (Help.longOption "notify")
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand' <+> Pretty.braces
            ( Help.longOption "list"
            <> "|"
            <> Help.longOption "ls"
            <> "|"
            <> Help.shortOption 'l'
            <> "|"
            <> Help.longOption "tree"
            <> "|"
            <> Help.shortOption 't'
            )

        , subcommand'
            <+> Help.longOptionWithArgument "expression" "EXPRESSION"
            <+> Pretty.brackets (Help.longOption "notify")
            <+> Pretty.brackets (Help.metavar "--")
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand'
            <+> Help.longOption "print"
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand'
            <+> Help.longOption "print-completion"
            <+> Help.longOptionWithArgument "index" "NUM"
            <+> Help.longOptionWithArgument "shell" "SHELL"
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand' <+> Help.helpOptions

        , "help" <+> Pretty.brackets (Help.longOption "man") <+> subcommand'
        ]

    , Help.section ("Options" <> ":")
        [ Help.optionDescription ["--list", "--ls", "-l"]
            [ Pretty.reflow "List available", Help.metavar "COMMAND" <> "s."
            ]

        , Help.optionDescription ["--tree", "-t"]
            [ Pretty.reflow "List available", Help.metavar "COMMAND" <> "s"
            , Pretty.reflow
                "in tree-like form treating dots (`.`) as separators."
            ]

        , Help.optionDescription ["--print"]
            [ Pretty.reflow
                "Print command as it will be executed in Dhall format."
            ]

        , Help.optionDescription ["--print-completion"]
            [ "Similar", "to", Help.longOption "print" <> ","
            , Pretty.reflow
                "but prints command that would be used to do command line\
                \ completion if it was invoked.  Additional options"
            , Help.longOptionWithArgument "index" "NUM" <> ",", "and"
            , Help.longOptionWithArgument "shell" "SHELL"
            , Pretty.reflow
                "are passed to the command line completion command."
            ]

        , Help.optionDescription ["--expression=EXPRESSION"]
            [ Pretty.reflow "Execute Dhall", Help.metavar "EXPRESSION" <> "."
            , Pretty.reflow "Expected type of", Help.metavar "EXPRESSION"
            , Pretty.reflow "is documented in"
            , Help.value "command-wrapper-exec(1)"
            , Pretty.reflow "manual page.  It can be viewed by calling"
            , Pretty.squotes
                ( Help.toolsetCommand name
                    ("help" <+> "--man" <+> subcommand')
                )
                <> "."
            ]

        , Help.optionDescription ["--notify"]
            [ Pretty.reflow
                "Send desktop notification when the command is done."
            ]

        , Help.optionDescription ["--help", "-h"]
            [ Pretty.reflow "Print this help and exit. Same as"
            , Pretty.squotes
                (Help.toolsetCommand name ("help" <+> subcommand')) <> "."
            ]

        , Help.optionDescription ["COMMAND"]
            [ Help.metavar "COMMAND" <+> Pretty.reflow "to execute."
            ]

        , Help.optionDescription ["COMMAND_ARGUMENTS"]
            [ Pretty.reflow "Additional arguments passed to"
            <+> Help.metavar "COMMAND" <> "."
            ]

        , Help.globalOptionsHelp name
        ]
    ]
  where
    subcommand' = fromString subcommand

helpMsg :: ExecParams -> Pretty.Doc (Result Pretty.AnsiStyle)
helpMsg ExecParams{protocol = Params{name, subcommand}} = Pretty.vsep
    [ Pretty.reflow "Execute a command with predefined environment and command\
        \ line options."
    , ""

    , Help.usageSection name
        [ subcommand'
            <+> Pretty.brackets (Help.longOption "notify")
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand' <+> Pretty.braces
            ( Help.longOption "list"
            <> "|"
            <> Help.longOption "ls"
            <> "|"
            <> Help.shortOption 'l'
            <> "|"
            <> Help.longOption "tree"
            <> "|"
            <> Help.shortOption 't'
            )

        , subcommand'
            <+> Help.longOptionWithArgument "expression" "EXPRESSION"
            <+> Pretty.brackets (Help.longOption "notify")
            <+> Pretty.brackets (Help.metavar "--")
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand'
            <+> Help.longOption "print"
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand'
            <+> Help.longOption "print-completion"
            <+> Help.longOptionWithArgument "index" "NUM"
            <+> Help.longOptionWithArgument "shell" "SHELL"
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand' <+> Help.helpOptions

        , "help" <+> Pretty.brackets (Help.longOption "man") <+> subcommand'
        ]

    , Help.section ("Options" <> ":")
        [ Help.optionDescription ["--list", "--ls", "-l"]
            [ Pretty.reflow "List available", Help.metavar "COMMAND" <> "s."
            ]

        , Help.optionDescription ["--tree", "-t"]
            [ Pretty.reflow "List available", Help.metavar "COMMAND" <> "s"
            , Pretty.reflow
                "in tree-like form treating dots (`.`) as separators."
            ]

        , Help.optionDescription ["--print"]
            [ Pretty.reflow
                "Print command as it will be executed in Dhall format."
            ]

        , Help.optionDescription ["--print-completion"]
            [ "Similar", "to", Help.longOption "print" <> ","
            , Pretty.reflow
                "but prints command that would be used to do command line\
                \ completion if it was invoked.  Additional options"
            , Help.longOptionWithArgument "index" "NUM" <> ",", "and"
            , Help.longOptionWithArgument "shell" "SHELL"
            , Pretty.reflow
                "are passed to the command line completion command."
            ]

        , Help.optionDescription ["--expression=EXPRESSION"]
            [ Pretty.reflow "Execute Dhall", Help.metavar "EXPRESSION" <> "."
            , Pretty.reflow "Expected type of", Help.metavar "EXPRESSION"
            , Pretty.reflow "is documented in"
            , Help.value "command-wrapper-exec(1)"
            , Pretty.reflow "manual page.  It can be viewed by calling"
            , Pretty.squotes
                ( Help.toolsetCommand name
                    ("help" <+> "--man" <+> subcommand')
                )
                <> "."
            ]

        , Help.optionDescription ["--notify"]
            [ Pretty.reflow
                "Send desktop notification when the command is done."
            ]

        , Help.optionDescription ["--help", "-h"]
            [ Pretty.reflow "Print this help and exit. Same as"
            , Pretty.squotes
                (Help.toolsetCommand name ("help" <+> subcommand')) <> "."
            ]

        , Help.optionDescription ["COMMAND"]
            [ Help.metavar "COMMAND" <+> Pretty.reflow "to execute."
            ]

        , Help.optionDescription ["COMMAND_ARGUMENTS"]
            [ Pretty.reflow "Additional arguments passed to"
            <+> Help.metavar "COMMAND" <> "."
            ]

        , Help.globalOptionsHelp name
        ]
    ]
  where
    subcommand' = fromString subcommand
helpMsg ExecParams{protocol = Params{name, subcommand}} = Pretty.vsep
    [ Pretty.reflow "Execute a command with predefined environment and command\
        \ line options."
    , ""

    , Help.usageSection name
        [ subcommand'
            <+> Pretty.brackets (Help.longOption "notify")
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand' <+> Pretty.braces
            ( Help.longOption "list"
            <> "|"
            <> Help.longOption "ls"
            <> "|"
            <> Help.shortOption 'l'
            <> "|"
            <> Help.longOption "tree"
            <> "|"
            <> Help.shortOption 't'
            )

        , subcommand'
            <+> Help.longOptionWithArgument "expression" "EXPRESSION"
            <+> Pretty.brackets (Help.longOption "notify")
            <+> Pretty.brackets (Help.metavar "--")
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand'
            <+> Help.longOption "print"
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand'
            <+> Help.longOption "print-completion"
            <+> Help.longOptionWithArgument "index" "NUM"
            <+> Help.longOptionWithArgument "shell" "SHELL"
            <+> Pretty.brackets (Help.metavar "--")
            <+> Help.metavar "COMMAND"
            <+> Pretty.brackets (Help.metavar "COMMAND_ARGUMENTS")

        , subcommand' <+> Help.helpOptions

        , "help" <+> Pretty.brackets (Help.longOption "man") <+> subcommand'
        ]

    , Help.section ("Options" <> ":")
        [ Help.optionDescription ["--list", "--ls", "-l"]
            [ Pretty.reflow "List available", Help.metavar "COMMAND" <> "s."
            ]

        , Help.optionDescription ["--tree", "-t"]
            [ Pretty.reflow "List available", Help.metavar "COMMAND" <> "s"
            , Pretty.reflow
                "in tree-like form treating dots (`.`) as separators."
            ]

        , Help.optionDescription ["--print"]
            [ Pretty.reflow
                "Print command as it will be executed in Dhall format."
            ]

        , Help.optionDescription ["--print-completion"]
            [ "Similar", "to", Help.longOption "print" <> ","
            , Pretty.reflow
                "but prints command that would be used to do command line\
                \ completion if it was invoked.  Additional options"
            , Help.longOptionWithArgument "index" "NUM" <> ",", "and"
            , Help.longOptionWithArgument "shell" "SHELL"
            , Pretty.reflow
                "are passed to the command line completion command."
            ]

        , Help.optionDescription ["--expression=EXPRESSION"]
            [ Pretty.reflow "Execute Dhall", Help.metavar "EXPRESSION" <> "."
            , Pretty.reflow "Expected type of", Help.metavar "EXPRESSION"
            , Pretty.reflow "is documented in"
            , Help.value "command-wrapper-exec(1)"
            , Pretty.reflow "manual page.  It can be viewed by calling"
            , Pretty.squotes
                ( Help.toolsetCommand name
                    ("help" <+> "--man" <+> subcommand')
                )
                <> "."
            ]

        , Help.optionDescription ["--notify"]
            [ Pretty.reflow
                "Send desktop notification when the command is done."
            ]

        , Help.optionDescription ["--help", "-h"]
            [ Pretty.reflow "Print this help and exit. Same as"
            , Pretty.squotes
                (Help.toolsetCommand name ("help" <+> subcommand')) <> "."
            ]

        , Help.optionDescription ["COMMAND"]
            [ Help.metavar "COMMAND" <+> Pretty.reflow "to execute."
            ]

        , Help.optionDescription ["COMMAND_ARGUMENTS"]
            [ Pretty.reflow "Additional arguments passed to"
            <+> Help.metavar "COMMAND" <> "."
            ]

        , Help.globalOptionsHelp name
        ]
    ]
  where
    subcommand' = fromString subcommand