forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
238 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
cli/commands/details/formatters/table/details_output_formatter_table.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "details_output_formatter_table.h" | ||
#include "../../../../cli_helpers.h" | ||
|
||
void details_output_formatter_print_header_table() { | ||
TOTP_CLI_PRINTF("+----------------------+------------------------------+\r\n"); | ||
TOTP_CLI_PRINTF("| %-20s | %-28s |\r\n", "Property", "Value"); | ||
TOTP_CLI_PRINTF("+----------------------+------------------------------+\r\n"); | ||
} | ||
|
||
void details_output_formatter_print_footer_table() { | ||
TOTP_CLI_PRINTF("+----------------------+------------------------------+\r\n"); | ||
} | ||
|
||
void details_output_formatter_print_automation_feature_table(const char* key, const char* feature, bool* header_printed) { | ||
TOTP_CLI_PRINTF( | ||
"| %-20s | %-28.28s |\r\n", | ||
*header_printed ? "" : key, | ||
feature); | ||
*header_printed = true; | ||
} | ||
|
||
void details_output_formatter_print_cstr_table(const char* key, const char* value) { | ||
TOTP_CLI_PRINTF("| %-20s | %-28.28s |\r\n", key, value); | ||
} | ||
|
||
void details_output_formatter_print_uint8t_table(const char* key, uint8_t value) { | ||
TOTP_CLI_PRINTF("| %-20s | %-28" PRIu8 " |\r\n", key, value); | ||
} | ||
|
||
void details_output_formatter_print_sizet_table(const char* key, size_t value) { | ||
TOTP_CLI_PRINTF("| %-20s | %-28" PRIu16 " |\r\n", key, value); | ||
} |
12 changes: 12 additions & 0 deletions
12
cli/commands/details/formatters/table/details_output_formatter_table.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
#include <stdbool.h> | ||
|
||
void details_output_formatter_print_header_table(); | ||
void details_output_formatter_print_footer_table(); | ||
void details_output_formatter_print_automation_feature_table(const char* key, const char* feature, bool* header_printed); | ||
void details_output_formatter_print_cstr_table(const char* key, const char* value); | ||
void details_output_formatter_print_uint8t_table(const char* key, uint8_t value); | ||
void details_output_formatter_print_sizet_table(const char* key, size_t value); |
29 changes: 29 additions & 0 deletions
29
cli/commands/details/formatters/tsv/details_output_formatter_tsv.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "details_output_formatter_tsv.h" | ||
#include "../../../../cli_helpers.h" | ||
|
||
void details_output_formatter_print_header_tsv() { | ||
TOTP_CLI_PRINTF("%s\t%s\r\n", "Property", "Value"); | ||
} | ||
|
||
void details_output_formatter_print_footer_tsv() { | ||
} | ||
|
||
void details_output_formatter_print_automation_feature_tsv(const char* key, const char* feature, bool* header_printed) { | ||
TOTP_CLI_PRINTF( | ||
"%s\t%s\r\n", | ||
*header_printed ? "" : key, | ||
feature); | ||
*header_printed = true; | ||
} | ||
|
||
void details_output_formatter_print_cstr_tsv(const char* key, const char* value) { | ||
TOTP_CLI_PRINTF("%s\t%s\r\n", key, value); | ||
} | ||
|
||
void details_output_formatter_print_uint8t_tsv(const char* key, uint8_t value) { | ||
TOTP_CLI_PRINTF("%s\t%" PRIu8 "\r\n", key, value); | ||
} | ||
|
||
void details_output_formatter_print_sizet_tsv(const char* key, size_t value) { | ||
TOTP_CLI_PRINTF("%s\t%" PRIu16 "\r\n", key, value); | ||
} |
12 changes: 12 additions & 0 deletions
12
cli/commands/details/formatters/tsv/details_output_formatter_tsv.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
#include <stdbool.h> | ||
|
||
void details_output_formatter_print_header_tsv(); | ||
void details_output_formatter_print_footer_tsv(); | ||
void details_output_formatter_print_automation_feature_tsv(const char* key, const char* feature, bool* header_printed); | ||
void details_output_formatter_print_cstr_tsv(const char* key, const char* value); | ||
void details_output_formatter_print_uint8t_tsv(const char* key, uint8_t value); | ||
void details_output_formatter_print_sizet_tsv(const char* key, size_t value); |
22 changes: 22 additions & 0 deletions
22
cli/commands/list/formatters/table/list_output_formatter_table.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "list_output_formatter_table.h" | ||
#include "../../../../cli_helpers.h" | ||
|
||
void list_output_formatter_print_header_table() { | ||
TOTP_CLI_PRINTF("+-----+---------------------------+--------+----+-----+\r\n"); | ||
TOTP_CLI_PRINTF("| %-3s | %-25s | %-6s | %-s | %-s |\r\n", "#", "Name", "Algo", "Ln", "Dur"); | ||
TOTP_CLI_PRINTF("+-----+---------------------------+--------+----+-----+\r\n"); | ||
} | ||
|
||
void list_output_formatter_print_body_item_table(size_t index, const TokenInfo* token_info) { | ||
TOTP_CLI_PRINTF( | ||
"| %-3" PRIu16 " | %-25.25s | %-6s | %-2" PRIu8 " | %-3" PRIu8 " |\r\n", | ||
index + 1, | ||
furi_string_get_cstr(token_info->name), | ||
token_info_get_algo_as_cstr(token_info), | ||
token_info->digits, | ||
token_info->duration); | ||
} | ||
|
||
void list_output_formatter_print_footer_table() { | ||
TOTP_CLI_PRINTF("+-----+---------------------------+--------+----+-----+\r\n"); | ||
} |
9 changes: 9 additions & 0 deletions
9
cli/commands/list/formatters/table/list_output_formatter_table.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include "../../../../../types/token_info.h" | ||
|
||
void list_output_formatter_print_header_table(); | ||
|
||
void list_output_formatter_print_body_item_table(size_t index, const TokenInfo* token_info); | ||
|
||
void list_output_formatter_print_footer_table(); |
19 changes: 19 additions & 0 deletions
19
cli/commands/list/formatters/tsv/list_output_formatter_tsv.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "list_output_formatter_tsv.h" | ||
#include "../../../../cli_helpers.h" | ||
|
||
void list_output_formatter_print_header_tsv() { | ||
TOTP_CLI_PRINTF("%s\t%s\t%s\t%s\t%s\r\n", "#", "Name", "Algo", "Ln", "Dur"); | ||
} | ||
|
||
void list_output_formatter_print_body_item_tsv(size_t index, const TokenInfo* token_info) { | ||
TOTP_CLI_PRINTF( | ||
"%" PRIu16 "\t%s\t%s\t%" PRIu8 "\t%" PRIu8 "\r\n", | ||
index + 1, | ||
furi_string_get_cstr(token_info->name), | ||
token_info_get_algo_as_cstr(token_info), | ||
token_info->digits, | ||
token_info->duration); | ||
} | ||
|
||
void list_output_formatter_print_footer_tsv() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include "../../../../../types/token_info.h" | ||
|
||
void list_output_formatter_print_header_tsv(); | ||
|
||
void list_output_formatter_print_body_item_tsv(size_t index, const TokenInfo* token_info); | ||
|
||
void list_output_formatter_print_footer_tsv(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters