alex.kopachov 2 лет назад
Родитель
Сommit
4f6d25c3bf

+ 16 - 7
cli/commands/details/details.c

@@ -12,7 +12,10 @@
 
 typedef void (*TOTP_CLI_DETAILS_HEADER_FORMATTER)();
 typedef void (*TOTP_CLI_DETAILS_FOOTER_FORMATTER)();
-typedef void (*TOTP_CLI_DETAILS_AUTOMATION_FEATURE_ITEM_FORMATTER)(const char* key, const char* feature, bool* header_printed);
+typedef void (*TOTP_CLI_DETAILS_AUTOMATION_FEATURE_ITEM_FORMATTER)(
+    const char* key,
+    const char* feature,
+    bool* header_printed);
 typedef void (*TOTP_CLI_DETAILS_CSTR_FORMATTER)(const char* key, const char* value);
 typedef void (*TOTP_CLI_DETAILS_UINT8T_FORMATTER)(const char* key, uint8_t value);
 typedef void (*TOTP_CLI_DETAILS_SIZET_FORMATTER)(const char* key, size_t value);
@@ -42,24 +45,30 @@ static const TotpCliDetailsFormatter available_formatters[] = {
      .sizet_formatter = &details_output_formatter_print_sizet_tsv},
 };
 
-static void print_automation_features(const TokenInfo* token_info, const TotpCliDetailsFormatter* formatter) {
+static void print_automation_features(
+    const TokenInfo* token_info,
+    const TotpCliDetailsFormatter* formatter) {
     bool header_printed = false;
     const char* AUTOMATION_FEATURES_PRINT_KEY = "Automation features";
     if(token_info->automation_features == TokenAutomationFeatureNone) {
-        (*formatter->automation_feature_item_formatter)(AUTOMATION_FEATURES_PRINT_KEY, "None", &header_printed);
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "None", &header_printed);
         return;
     }
-    
+
     if(token_info->automation_features & TokenAutomationFeatureEnterAtTheEnd) {
-        (*formatter->automation_feature_item_formatter)(AUTOMATION_FEATURES_PRINT_KEY, "Type <Enter> key at the end", &header_printed);
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "Type <Enter> key at the end", &header_printed);
     }
 
     if(token_info->automation_features & TokenAutomationFeatureTabAtTheEnd) {
-        (*formatter->automation_feature_item_formatter)(AUTOMATION_FEATURES_PRINT_KEY, "Type <Tab> key at the end", &header_printed);
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "Type <Tab> key at the end", &header_printed);
     }
 
     if(token_info->automation_features & TokenAutomationFeatureTypeSlower) {
-        (*formatter->automation_feature_item_formatter)(AUTOMATION_FEATURES_PRINT_KEY, "Type slower", &header_printed);
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "Type slower", &header_printed);
     }
 }
 

+ 6 - 6
cli/commands/details/formatters/table/details_output_formatter_table.c

@@ -11,12 +11,12 @@ 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_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) {

+ 4 - 1
cli/commands/details/formatters/table/details_output_formatter_table.h

@@ -6,7 +6,10 @@
 
 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_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);

+ 6 - 6
cli/commands/details/formatters/tsv/details_output_formatter_tsv.c

@@ -8,12 +8,12 @@ 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) {
-    TOTP_CLI_PRINTF(
-            "%s\t%s\r\n",
-            *header_printed ? "" : key,
-            feature);
-        *header_printed = true;
+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) {

+ 4 - 1
cli/commands/details/formatters/tsv/details_output_formatter_tsv.h

@@ -6,7 +6,10 @@
 
 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_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);

+ 1 - 2
cli/commands/list/list.c

@@ -26,8 +26,7 @@ static const TotpCliListFormatter available_formatters[] = {
 
     {.header_formatter = &list_output_formatter_print_header_tsv,
      .body_item_formatter = &list_output_formatter_print_body_item_tsv,
-     .footer_formatter = &list_output_formatter_print_footer_tsv}
-};
+     .footer_formatter = &list_output_formatter_print_footer_tsv}};
 
 #ifdef TOTP_CLI_RICH_HELP_ENABLED
 void totp_cli_command_list_docopt_commands() {