mirror of
https://github.com/curl/curl.git
synced 2026-07-29 04:33:06 +03:00
curl: add -h cheat-sheet using curl-cheat-sheet as text
Resolve failing checks.
This commit is contained in:
parent
c0622c9abf
commit
245d996a74
1 changed files with 17 additions and 29 deletions
|
|
@ -437,7 +437,8 @@ static const struct cheat_table {
|
|||
{{NULL, NULL}}
|
||||
};
|
||||
|
||||
static int incre_i(int i, int j) {
|
||||
static int incre_i(int i, int j)
|
||||
{
|
||||
if(j == 0)
|
||||
return i + 1;
|
||||
else
|
||||
|
|
@ -445,7 +446,8 @@ static int incre_i(int i, int j) {
|
|||
}
|
||||
|
||||
/* Support to print number of columns per screen width. */
|
||||
static void print_cheatsheet(int i, int col_num) {
|
||||
static void print_cheatsheet(int i, int col_num)
|
||||
{
|
||||
/* Spacer variable for heading. */
|
||||
const char *spacer = "------------------------------";
|
||||
|
||||
|
|
@ -454,18 +456,15 @@ static void print_cheatsheet(int i, int col_num) {
|
|||
|
||||
if(col_num == 1) {
|
||||
if(cheat_items[i].heading[0] &&
|
||||
cheat_items[i].heading[0] != NULL &&
|
||||
strcmp(cheat_items[i].heading[0], "") != 0)
|
||||
printf("%-20s\n%s\n%s\n\n",
|
||||
cheat_items[i].heading[0], spacer, cheat_items[i].heading[1]);
|
||||
}
|
||||
else if(col_num == 2) {
|
||||
if(cheat_items[i + 1].heading[0] &&
|
||||
cheat_items[i + 1].heading[0] == NULL)
|
||||
if(!cheat_items[i + 1].heading[0])
|
||||
print_cheatsheet(i, 1);
|
||||
else
|
||||
if(cheat_items[i].heading[0] &&
|
||||
cheat_items[i].heading[0] != NULL &&
|
||||
strcmp(cheat_items[i].heading[0], "") != 0)
|
||||
printf("%-*s %-*s\n%s %s\n%-*s %-*s\n\n",
|
||||
width, cheat_items[i].heading[0],
|
||||
|
|
@ -475,15 +474,12 @@ static void print_cheatsheet(int i, int col_num) {
|
|||
width, cheat_items[i + 1].heading[1]);
|
||||
}
|
||||
else if(col_num == 3) {
|
||||
if(cheat_items[i + 1].heading[0] &&
|
||||
cheat_items[i + 1].heading[0] == NULL)
|
||||
if(!cheat_items[i + 1].heading[0])
|
||||
print_cheatsheet(i, 1);
|
||||
else if(cheat_items[i + 2].heading[0] &&
|
||||
cheat_items[i + 2].heading[0] == NULL)
|
||||
else if(!cheat_items[i + 2].heading[0])
|
||||
print_cheatsheet(i, 2);
|
||||
else
|
||||
if(cheat_items[i].heading[0] &&
|
||||
cheat_items[i].heading[0] != NULL &&
|
||||
if(cheat_items[i].heading[0] &&
|
||||
strcmp(cheat_items[i].heading[0], "") != 0)
|
||||
printf("%-*s %-*s %-*s\n%s %s %s\n%-*s %-*s %-*s\n\n",
|
||||
width, cheat_items[i].heading[0],
|
||||
|
|
@ -495,19 +491,15 @@ static void print_cheatsheet(int i, int col_num) {
|
|||
width, cheat_items[i + 2].heading[1]);
|
||||
}
|
||||
else if(col_num == 4) {
|
||||
if(cheat_items[i + 1].heading[0] &&
|
||||
cheat_items[i + 1].heading[0] == NULL)
|
||||
if(!cheat_items[i + 1].heading[0])
|
||||
print_cheatsheet(i, 1);
|
||||
else if(cheat_items[i + 2].heading[0] &&
|
||||
cheat_items[i + 2].heading[0] == NULL)
|
||||
else if(!cheat_items[i + 2].heading[0])
|
||||
print_cheatsheet(i, 2);
|
||||
else if(cheat_items[i + 3].heading[0] &&
|
||||
cheat_items[i + 3].heading[0] == NULL)
|
||||
else if(!cheat_items[i + 3].heading[0])
|
||||
print_cheatsheet(i, 3);
|
||||
else
|
||||
if(cheat_items[i].heading[0] &&
|
||||
cheat_items[i].heading[0] != NULL &&
|
||||
strcmp(cheat_items[i].heading[0], "") != 0)
|
||||
if(cheat_items[i].heading[0] &&
|
||||
strcmp(cheat_items[i].heading[0], "") != 0)
|
||||
printf("%-*s %-*s %-*s %-*s\n%s %s %s %s\n"
|
||||
"%-*s %-*s %-*s %-*s\n\n",
|
||||
width, cheat_items[i].heading[0],
|
||||
|
|
@ -521,21 +513,17 @@ static void print_cheatsheet(int i, int col_num) {
|
|||
width, cheat_items[i + 3].heading[1]);
|
||||
}
|
||||
else if(col_num == 5) {
|
||||
if(cheat_items[i + 1].heading[0] &&
|
||||
cheat_items[i + 1].heading[0] == NULL)
|
||||
if(!cheat_items[i + 1].heading[0])
|
||||
print_cheatsheet(i, 1);
|
||||
else if(cheat_items[i + 2].heading[0] &&
|
||||
cheat_items[i + 2].heading[0] == NULL)
|
||||
else if(!cheat_items[i + 2].heading[0])
|
||||
print_cheatsheet(i, 2);
|
||||
else if(cheat_items[i + 3].heading[0] &&
|
||||
cheat_items[i + 3].heading[0] == NULL)
|
||||
else if(!cheat_items[i + 3].heading[0])
|
||||
print_cheatsheet(i, 3);
|
||||
else if(cheat_items[i + 4].heading[0] &&
|
||||
cheat_items[i + 4].heading[0] == NULL)
|
||||
print_cheatsheet(i, 4);
|
||||
else
|
||||
if(cheat_items[i].heading[0] &&
|
||||
cheat_items[i].heading[0] != NULL &&
|
||||
strcmp(cheat_items[i].heading[0], "") != 0)
|
||||
printf("%-*s %-*s %-*s %-*s %-*s\n%s %s %s %s %s\n"
|
||||
"%-*s %-*s %-*s %-*s %-*s\n\n",
|
||||
|
|
@ -579,7 +567,7 @@ void tool_cheat_sheet(void)
|
|||
|
||||
/* Loop through cheat sheet sections */
|
||||
for(i = 0; i < table_length; i = incre_i(i, j)) {
|
||||
if(cheat_items[i+j].heading[0] == NULL) {
|
||||
if(!cheat_items[i + j].heading[0]) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue