From bad88dcadbde68d07377a71988a9fb4d3dde1b3e Mon Sep 17 00:00:00 2001 From: Maxim Fedorov Date: Wed, 18 May 2022 08:32:56 -0700 Subject: [PATCH] [argparse] fix incorrect specs Closes #38. --- README.md | 3 +++ doc/overview.edoc | 2 +- rebar.lock | 1 + src/argparse.app.src | 2 +- src/argparse.erl | 6 +++--- 5 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 rebar.lock diff --git a/README.md b/README.md index 5cd93fa..a51e36e 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,9 @@ To be considered after 1.2.0: ## Changelog +Verson 1.2.4: + * minor spec fixes + Verson 1.2.3: * implemented global default * minor bugfixes diff --git a/doc/overview.edoc b/doc/overview.edoc index 2d00c2b..1620ecb 100644 --- a/doc/overview.edoc +++ b/doc/overview.edoc @@ -1,6 +1,6 @@ ** this is the overview.doc file for the application 'argparse' ** - @version 1.2.3 + @version 1.2.4 @author Maxim Fedorov, @title argparse: A simple framework to create complex CLI. diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 0000000..57afcca --- /dev/null +++ b/rebar.lock @@ -0,0 +1 @@ +[]. diff --git a/src/argparse.app.src b/src/argparse.app.src index d132cc0..bc527c7 100644 --- a/src/argparse.app.src +++ b/src/argparse.app.src @@ -1,6 +1,6 @@ {application, argparse, [{description, "argparse: arguments parser, and cli framework"}, - {vsn, "1.2.3"}, + {vsn, "1.2.4"}, {applications, [kernel, stdlib diff --git a/src/argparse.erl b/src/argparse.erl index bace2d8..12dcd4c 100644 --- a/src/argparse.erl +++ b/src/argparse.erl @@ -239,18 +239,18 @@ command => [string()] %% nested command (missing/empty for top-level command) }. --type command_spec() :: {Name :: string(), command()}. %% Command name with command spec +-type command_spec() :: {Name :: [string()], command()}. %% Command name with command spec -type parse_result() :: arg_map() | {arg_map(), command_spec()}. %% Result returned from parse/2,3: can be only argument map, or argument map with command_spec. %% @equiv validate(Command, #{}) --spec validate(command()) -> command_spec(). +-spec validate(command()) -> {Progname :: string(), command()}. validate(Command) -> validate(Command, #{}). %% @doc Validate command specification, taking Options into account. %% Generates error signal when command specification is invalid. --spec validate(command(), parser_options()) -> command_spec(). +-spec validate(command(), parser_options()) -> {Progname :: string(), command()}. validate(Command, Options) -> validate_impl(Command, Options).