Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 007853b

Browse files
author
Sean Cribbs
committedMar 11, 2015
Fix type specs for usage registration.
This was missed when the function form of usage was created, resulting in the 'clique' module having a narrower spec than the 'clique_usage' module. Prompted by basho/riak_repl#660.
1 parent ac00915 commit 007853b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎src/clique.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ register_command(Cmd, Keys, Flags, Fun) ->
7676

7777
%% @doc Register usage for a given command sequence. Lookups are by longest
7878
%% match.
79-
-spec register_usage([string()], iolist()) -> true.
79+
-spec register_usage([string()], clique_usage:usage()) -> true.
8080
register_usage(Cmd, Usage) ->
8181
clique_usage:register(Cmd, Usage).
8282

‎src/clique_usage.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
-type err() :: {error, term()}.
3131
-type usage_function() :: fun(() -> iolist()).
32+
-type usage() :: iolist() | usage_function().
33+
34+
-export_type([usage/0]).
3235

3336
%% API
3437
-export([init/0,
@@ -42,7 +45,7 @@ init() ->
4245

4346
%% @doc Register usage for a given command sequence. Lookups are by longest
4447
%% match.
45-
-spec register([string()], iolist() | usage_function()) -> true.
48+
-spec register([string()], usage()) -> true.
4649
register(Cmd, Usage) ->
4750
ets:insert(?usage_table, {Cmd, Usage}).
4851

0 commit comments

Comments
 (0)