cli_common_helpers.c 790 B

123456789101112131415161718192021222324252627
  1. #include "cli_common_helpers.h"
  2. #include <cli/cli.h>
  3. void totp_cli_print_invalid_arguments() {
  4. TOTP_CLI_PRINTF(
  5. "Invalid command arguments. use \"help\" command to get list of available commands");
  6. }
  7. bool totp_cli_ensure_authenticated(PluginState* plugin_state, Cli* cli) {
  8. if(plugin_state->current_scene == TotpSceneAuthentication) {
  9. TOTP_CLI_PRINTF("Pleases enter PIN on your flipper device\r\n");
  10. while(plugin_state->current_scene == TotpSceneAuthentication &&
  11. !cli_cmd_interrupt_received(cli)) {
  12. furi_delay_tick(0);
  13. }
  14. TOTP_CLI_PRINTF("\033[A\33[2K\r");
  15. fflush(stdout);
  16. if(plugin_state->current_scene == TotpSceneAuthentication) {
  17. return false;
  18. }
  19. }
  20. return true;
  21. }