cli_common_helpers.c 769 B

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