Skip to content

Commit

Permalink
Merge pull request #39 from max-au/max-au/fix-parse-spec
Browse files Browse the repository at this point in the history
[argparse] fix incorrect specs
  • Loading branch information
max-au authored May 18, 2022
2 parents 55caa1d + bad88dc commit 4d00903
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/overview.edoc
Original file line number Diff line number Diff line change
@@ -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, <maximfca@gmail.com>
@title argparse: A simple framework to create complex CLI.

Expand Down
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[].
2 changes: 1 addition & 1 deletion src/argparse.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, argparse,
[{description, "argparse: arguments parser, and cli framework"},
{vsn, "1.2.3"},
{vsn, "1.2.4"},
{applications,
[kernel,
stdlib
Expand Down
6 changes: 3 additions & 3 deletions src/argparse.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down

0 comments on commit 4d00903

Please sign in to comment.