Incremental improvements to tabular output modes in the CLI. The
"markdown" and "table" modes no have headers turned on by default. FossilOrigin-Name: af28bff91ad7e2d69db0052323c9c05c75a41d4134974bd1305f1c4f579d3558
This commit is contained in:
parent
d31fcd4751
commit
d6f252490e
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Expand\supon\sa\scomment\sin\sos_unix.c.\sNo\schanges\sto\scode.
|
||||
D 2020-05-29T11:07:20.452
|
||||
C Incremental\simprovements\sto\stabular\soutput\smodes\sin\sthe\sCLI.\s\sThe\n"markdown"\sand\s"table"\smodes\sno\shave\sheaders\sturned\son\sby\sdefault.
|
||||
D 2020-05-29T12:31:53.495
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -534,7 +534,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c c2008519a0654f1e7490e9281ed0397d0f14bb840d81f0b96946248afcbdb25d
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 39a00a8bc89596dfb37c16afcbb1d33de5085b9963564b58aafe1566d08c0881
|
||||
F src/shell.c.in f545fcc628411490e986e9f4fb9418f1eb25c85fd349924e852f7aac5da4fd0b
|
||||
F src/shell.c.in 17fff6834b839d684371a436f6c863dfbb8cb82ea8e4210b6090d9e8a6829dc3
|
||||
F src/sqlite.h.in 74342b41e9d68ff9e56b192009046f8dd0aa2bd76ce1a588f330de614ba61de7
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
|
||||
@ -1866,7 +1866,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 0278147a7d2b50bed9f59ed3d3a04ecc6d46f072eb510e463f6707df1d829020
|
||||
R 6168b01ac7944b1dec923e20df70ebab
|
||||
U dan
|
||||
Z 464f9a3c62e750102957cbf88d682eca
|
||||
P 77933dc4dbe0e0af3b13a14293a8bd684edc5056f4ae9291c6f95d4433bf90ce
|
||||
R dbd1cec93fc87562979dbfde2067c782
|
||||
U drh
|
||||
Z 42d147ea1b5d379198ee1e0c91039dc7
|
||||
|
@ -1 +1 @@
|
||||
77933dc4dbe0e0af3b13a14293a8bd684edc5056f4ae9291c6f95d4433bf90ce
|
||||
af28bff91ad7e2d69db0052323c9c05c75a41d4134974bd1305f1c4f579d3558
|
@ -1967,7 +1967,7 @@ static int shell_callback(
|
||||
int nArg, /* Number of result columns */
|
||||
char **azArg, /* Text of each result column */
|
||||
char **azCol, /* Column names */
|
||||
int *aiType /* Column types */
|
||||
int *aiType /* Column types. Might be NULL */
|
||||
){
|
||||
int i;
|
||||
ShellState *p = (ShellState*)pArg;
|
||||
@ -1992,36 +1992,43 @@ static int shell_callback(
|
||||
case MODE_Markdown:
|
||||
case MODE_Explain:
|
||||
case MODE_Column: {
|
||||
static const int aExplainWidths[] = {4, 13, 4, 4, 4, 13, 2, 13};
|
||||
const int *colWidth;
|
||||
int showHdr;
|
||||
char *rowSep;
|
||||
char *colSep;
|
||||
char *rowStart;
|
||||
int nWidth;
|
||||
if( p->cMode==MODE_Column ){
|
||||
colWidth = p->colWidth;
|
||||
nWidth = ArraySize(p->colWidth);
|
||||
showHdr = p->showHeader;
|
||||
rowSep = p->rowSeparator;
|
||||
colSep = " ";
|
||||
rowStart = "";
|
||||
}else if( p->cMode==MODE_Explain ){
|
||||
colWidth = aExplainWidths;
|
||||
nWidth = ArraySize(aExplainWidths);
|
||||
showHdr = 1;
|
||||
rowSep = SEP_Row;
|
||||
colSep = " ";
|
||||
rowStart = "";
|
||||
}else{
|
||||
colWidth = p->colWidth;
|
||||
nWidth = ArraySize(p->colWidth);
|
||||
showHdr = p->showHeader;
|
||||
showHdr = 1;
|
||||
rowSep = " |\n";
|
||||
colSep = " | ";
|
||||
rowStart = "| ";
|
||||
}
|
||||
|
||||
if( p->cnt++==0 ){
|
||||
/* Compute column widths in p->actualWidth[] when the first row
|
||||
** is seen. The width of each column is either the defined
|
||||
** width in p->colWidth[], or if p->colWidth[i]==0, then the
|
||||
** width is the larger of the width of the first row and the
|
||||
** column name. */
|
||||
static const int aExplainWidths[] = {4, 13, 4, 4, 4, 13, 2, 13};
|
||||
const int *colWidth;
|
||||
int nWidth;
|
||||
if( p->cMode==MODE_Explain ){
|
||||
colWidth = aExplainWidths;
|
||||
nWidth = ArraySize(aExplainWidths);
|
||||
}else{
|
||||
colWidth = p->colWidth;
|
||||
nWidth = ArraySize(p->colWidth);
|
||||
}
|
||||
for(i=0; i<nArg; i++){
|
||||
int w, n;
|
||||
if( i<nWidth ){
|
||||
@ -2039,10 +2046,10 @@ static int shell_callback(
|
||||
p->actualWidth[i] = w;
|
||||
}
|
||||
}
|
||||
if( p->cMode==MODE_Table ){
|
||||
print_row_separator(p, nArg, "+");
|
||||
}
|
||||
if( showHdr ){
|
||||
if( p->cMode==MODE_Table ){
|
||||
print_row_separator(p, nArg, "+");
|
||||
}
|
||||
fputs(rowStart, p->out);
|
||||
for(i=0; i<nArg; i++){
|
||||
int w;
|
||||
@ -2087,14 +2094,16 @@ static int shell_callback(
|
||||
}else{
|
||||
w = 10;
|
||||
}
|
||||
if( p->cMode==MODE_Explain && azArg[i] && strlenChar(azArg[i])>w ){
|
||||
w = strlenChar(azArg[i]);
|
||||
}
|
||||
if( i==1 && p->aiIndent && p->pStmt ){
|
||||
if( p->iIndent<p->nIndent ){
|
||||
utf8_printf(p->out, "%*.s", p->aiIndent[p->iIndent], "");
|
||||
if( p->cMode==MODE_Explain ){
|
||||
if( azArg[i] && strlenChar(azArg[i])>w ){
|
||||
w = strlenChar(azArg[i]);
|
||||
}
|
||||
if( i==1 && p->aiIndent && p->pStmt ){
|
||||
if( p->iIndent<p->nIndent ){
|
||||
utf8_printf(p->out, "%*.s", p->aiIndent[p->iIndent], "");
|
||||
}
|
||||
p->iIndent++;
|
||||
}
|
||||
p->iIndent++;
|
||||
}
|
||||
utf8_width_print(p->out, w, azArg[i] ? azArg[i] : p->nullValue);
|
||||
utf8_printf(p->out, "%s", i==nArg-1 ? rowSep : colSep);
|
||||
|
Loading…
Reference in New Issue
Block a user