void list_chisels(vector<chisel_desc>* chlist) { uint32_t j, l; // // Sort the list by name // sort(chlist->begin(), chlist->end(), summary_chisel_comparer()); string last_category; // // Print the list to the screen // for(j = 0; j < chlist->size(); j++) { chisel_desc* cd = &(chlist->at(j)); string category = cd->m_category; if(category != last_category) { printf("\n----------------------\n"); printf("Category: %s\n", category.c_str()); last_category = category; } printf("%s", cd->m_name.c_str()); uint32_t namelen = cd->m_name.size(); ASSERT(namelen < (DESCRIPTION_TEXT_START - 2)); for(l = 0; l < (DESCRIPTION_TEXT_START - namelen - 2); l++) { printf(" "); } string desc = cd->m_shortdesc; size_t desclen = desc.size(); for(l = 0; l < desclen; l++) { if(l % (CONSOLE_LINE_LEN - DESCRIPTION_TEXT_START) == 0 && l != 0) { printf("\n%" PRINTF_WRAP(DESCRIPTION_TEXT_START) "s", ""); } printf("%c", desc[l]); } printf("\n"); } }
void list_chisels(vector<chisel_desc>* chlist) { uint32_t j, l; // // Sort the list by name // sort(chlist->begin(), chlist->end(), summary_chisel_comparer()); string last_category; // // Print the list to the screen // for(j = 0; j < chlist->size(); j++) { chisel_desc* cd = &(chlist->at(j)); string category = cd->m_category; if(category != last_category) { string fullcatstr = "Category: " + category; printf("\n%s\n", fullcatstr.c_str()); for(l = 0; l < fullcatstr.size(); l++) { putchar('-'); } printf("\n"); last_category = category; } printf("%s", cd->m_name.c_str()); uint32_t namelen = cd->m_name.size(); ASSERT(namelen < (DESCRIPTION_TEXT_START - 2)); for(l = 0; l < (DESCRIPTION_TEXT_START - namelen - 2); l++) { printf(" "); } string desc = cd->m_shortdesc; size_t desclen = desc.size(); for(l = 0; l < desclen; l++) { if(l % (CONSOLE_LINE_LEN - DESCRIPTION_TEXT_START) == 0 && l != 0) { printf("\n%" PRINTF_WRAP(DESCRIPTION_TEXT_START) "s", ""); } printf("%c", desc[l]); } printf("\n"); } printf("\nUse the -i flag to get detailed information about a specific chisel\n"); }