Skip to content

cli:run_options/0 is not a subtype of argparse:parser_options/0 #43

Description

@zerth

cli:run/2 accepts a run_options() which is later passed directly to functions of argparse expecting a parser_options(). This leads to dialyzer errors when passing keys which are only allowed in run_options(); e.g., error.

Dialyzing the calc example app amended to include the following (in a thingy.erl module):

main(Args) ->
    cli:run(Args, #{error => error, progname => "calc"}).

results in:

thingy.erl:5:1: Function main/1 has no local return
thingy.erl:6:19: The call cli:run
         (Args :: any(),
          #{error => error, progname => "calc"}) will never return since it differs in the 2nd argument from the success typing arguments:
         (any(),
          #{'error' => 'ok', _ => _})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions