Browse Source

Few more refactoring

alex.kopachov 3 years ago
parent
commit
3bde3140be
3 changed files with 8 additions and 7 deletions
  1. 1 1
      FAQ.md
  2. 6 5
      totp/services/cli/cli.c
  3. 1 1
      totp/services/cli/cli_common_helpers.c

+ 1 - 1
FAQ.md

@@ -27,7 +27,7 @@ Detailed description of file format can be found [here](.github/conf-file_descri
 ## Is there a CLI?
 
 **YES!**
-When Flipper Authenticator is running `totp` CLI command will be available for you to list, add or remove tokens.
+When Flipper Authenticator is running `totp` CLI is available for you to list, add or remove tokens. Run `totp help` to get list of available commands and arguments.
 
 ## How to change\recover PIN?
 

+ 6 - 5
totp/services/cli/cli.c

@@ -2,6 +2,7 @@
 
 #include "cli.h"
 #include <lib/toolbox/args.h>
+#include "cli_common_helpers.h"
 #include "commands/list/list.h"
 #include "commands/add/add.h"
 #include "commands/delete/delete.h"
@@ -11,14 +12,14 @@
 #define TOTP_CLI_COMMAND_HELP "help"
 
 static void totp_cli_print_unknown_command(FuriString* unknown_command) {
-    printf("Command \"%s\" is unknown. Use \"help\" command to get list of available commands.", furi_string_get_cstr(unknown_command));
+    TOTP_CLI_PRINTF("Command \"%s\" is unknown. Use \"help\" command to get list of available commands.", furi_string_get_cstr(unknown_command));
 }
 
 static void totp_cli_print_help() {
-    printf("Usage:\r\n");
-    printf(TOTP_CLI_COMMAND_NAME " <command> <arguments>\r\n");
-    printf("Command list:\r\n");
-    printf("\t" TOTP_CLI_COMMAND_HELP " - print command usage help\r\n\r\n");
+    TOTP_CLI_PRINTF("Usage:\r\n");
+    TOTP_CLI_PRINTF(TOTP_CLI_COMMAND_NAME " <command> <arguments>\r\n");
+    TOTP_CLI_PRINTF("Command list:\r\n");
+    TOTP_CLI_PRINTF("\t" TOTP_CLI_COMMAND_HELP " - print command usage help\r\n\r\n");
     totp_cli_command_list_print_help();
     totp_cli_command_delete_print_help();
     totp_cli_command_add_print_help();

+ 1 - 1
totp/services/cli/cli_common_helpers.c

@@ -2,7 +2,7 @@
 #include <cli/cli.h>
 
 void totp_cli_print_invalid_arguments() {
-    printf("Invalid command arguments. use \"help\" command to get list of available commands");
+    TOTP_CLI_PRINTF("Invalid command arguments. use \"help\" command to get list of available commands");
 }
 
 bool totp_cli_ensure_authenticated(PluginState* plugin_state, Cli* cli) {