From e7b6778a43a7b120f8c9db56c348448b11fbdc2e Mon Sep 17 00:00:00 2001 From: Feng Date: Thu, 1 Oct 2015 11:22:33 +0800 Subject: [PATCH] rm cli --- src/emqttd_plugins.erl | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/emqttd_plugins.erl b/src/emqttd_plugins.erl index ba1c1b408..8e23f41e1 100644 --- a/src/emqttd_plugins.erl +++ b/src/emqttd_plugins.erl @@ -30,9 +30,6 @@ -author("Feng Lee "). -include("emqttd.hrl"). --include("emqttd_cli.hrl"). - --export([cli/1]). -export([load/0, unload/0]). @@ -40,36 +37,6 @@ -export([list/0]). -%%------------------------------------------------------------------------------ -%% CLI callback -%%------------------------------------------------------------------------------ - -cli(["list"]) -> - lists:foreach(fun(Plugin) -> print(Plugin) end, list()); - -cli(["load", Name]) -> - case load(list_to_atom(Name)) of - {ok, StartedApps} -> ?PRINT("Start apps: ~p~nPlugin ~s loaded successfully.~n", [StartedApps, Name]); - {error, Reason} -> ?PRINT("load plugin error: ~p~n", [Reason]) - end; - -cli(["unload", Name]) -> - case emqttd_plugins:unload(list_to_atom(Name)) of - ok -> - ?PRINT("Plugin ~s unloaded successfully.~n", [Name]); - {error, Reason} -> - ?PRINT("unload plugin error: ~p~n", [Reason]) - end; - -cli(_) -> - ?PRINT_CMD("plugins list", "#query loaded plugins"), - ?PRINT_CMD("plugins load ", "#load plugin"), - ?PRINT_CMD("plugins unload ", "#unload plugin"). - -print(#mqtt_plugin{name = Name, version = Ver, descr = Descr, active = Active}) -> - ?PRINT("Plugin(~s, version=~s, description=~s, active=~s)~n", - [Name, Ver, Descr, Active]). - %%------------------------------------------------------------------------------ %% @doc Load all plugins when the broker started. %% @end @@ -77,7 +44,6 @@ print(#mqtt_plugin{name = Name, version = Ver, descr = Descr, active = Active}) -spec load() -> list() | {error, any()}. load() -> - emqttd_ctl:register_cmd(plugins, {?MODULE, cli}, []), case env(loaded_file) of {ok, File} -> with_loaded_file(File, fun(Names) -> load_plugins(Names, false) end);