|
@@ -21,6 +21,14 @@
|
|
|
#include "cli_plugin_interface.h"
|
|
#include "cli_plugin_interface.h"
|
|
|
#include "../app_api_interface.h"
|
|
#include "../app_api_interface.h"
|
|
|
|
|
|
|
|
|
|
+#ifndef RECORD_CLI
|
|
|
|
|
+#define RECORD_CLI "cli"
|
|
|
|
|
+#else
|
|
|
|
|
+#define cli_registry_add_command cli_add_command
|
|
|
|
|
+#define cli_registry_delete_command cli_delete_command
|
|
|
|
|
+#define CliRegistry Cli
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
struct TotpCliContext {
|
|
struct TotpCliContext {
|
|
|
PluginState* plugin_state;
|
|
PluginState* plugin_state;
|
|
|
CompositeApiResolver* plugin_api_resolver;
|
|
CompositeApiResolver* plugin_api_resolver;
|
|
@@ -152,7 +160,7 @@ static void totp_cli_handler(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TotpCliContext* totp_cli_register_command_handler(PluginState* plugin_state) {
|
|
TotpCliContext* totp_cli_register_command_handler(PluginState* plugin_state) {
|
|
|
- Cli* cli = furi_record_open(RECORD_CLI);
|
|
|
|
|
|
|
+ CliRegistry* cli = furi_record_open(RECORD_CLI);
|
|
|
TotpCliContext* context = malloc(sizeof(TotpCliContext));
|
|
TotpCliContext* context = malloc(sizeof(TotpCliContext));
|
|
|
furi_check(context != NULL);
|
|
furi_check(context != NULL);
|
|
|
context->plugin_state = plugin_state;
|
|
context->plugin_state = plugin_state;
|
|
@@ -161,15 +169,15 @@ TotpCliContext* totp_cli_register_command_handler(PluginState* plugin_state) {
|
|
|
composite_api_resolver_add(context->plugin_api_resolver, firmware_api_interface);
|
|
composite_api_resolver_add(context->plugin_api_resolver, firmware_api_interface);
|
|
|
composite_api_resolver_add(context->plugin_api_resolver, application_api_interface);
|
|
composite_api_resolver_add(context->plugin_api_resolver, application_api_interface);
|
|
|
|
|
|
|
|
- cli_add_command(
|
|
|
|
|
|
|
+ cli_registry_add_command(
|
|
|
cli, TOTP_CLI_COMMAND_NAME, CliCommandFlagParallelSafe, totp_cli_handler, context);
|
|
cli, TOTP_CLI_COMMAND_NAME, CliCommandFlagParallelSafe, totp_cli_handler, context);
|
|
|
furi_record_close(RECORD_CLI);
|
|
furi_record_close(RECORD_CLI);
|
|
|
return context;
|
|
return context;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void totp_cli_unregister_command_handler(TotpCliContext* context) {
|
|
void totp_cli_unregister_command_handler(TotpCliContext* context) {
|
|
|
- Cli* cli = furi_record_open(RECORD_CLI);
|
|
|
|
|
- cli_delete_command(cli, TOTP_CLI_COMMAND_NAME);
|
|
|
|
|
|
|
+ CliRegistry* cli = furi_record_open(RECORD_CLI);
|
|
|
|
|
+ cli_registry_delete_command(cli, TOTP_CLI_COMMAND_NAME);
|
|
|
|
|
|
|
|
composite_api_resolver_free(context->plugin_api_resolver);
|
|
composite_api_resolver_free(context->plugin_api_resolver);
|
|
|
|
|
|