From: drh <> Date: Wed, 25 Sep 2024 15:55:52 +0000 (+0000) Subject: Add the --plain option to the ".www" dot-command. X-Git-Tag: version-3.47.0~91^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=878db7b099ed8928ec18a584a2efa7d9d3ff4f45;p=thirdparty%2Fsqlite.git Add the --plain option to the ".www" dot-command. FossilOrigin-Name: a9209519f612e66cfe11c89e70efd8285a0185ac0d3e5795846aafbd05d7a21f --- diff --git a/manifest b/manifest index 76054939a5..85c44e231b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\sthe\szipfile\sand\sfileio\sextensions\suse\ssqlite3_stdio.c\swhen\sit\sis\navailable\s-\ssuch\sas\swhen\sthose\sextensions\sare\spreloaded\sinto\sthe\sCLI. -D 2024-09-25T15:26:37.435 +C Add\sthe\s--plain\soption\sto\sthe\s".www"\sdot-command. +D 2024-09-25T15:55:52.425 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -770,7 +770,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 9750a281f7ba073b4e6da2be1a6c4071f5d841a7746c5fb3f70d6d793b6675ea F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 4b14337a2742f0c0beeba490e9a05507e9b4b12184b9cd12773501d08d48e3fe -F src/shell.c.in 9e32f35af780b0369cac93730d6c7e4440c7ec8a7382525da913e406491a1e46 +F src/shell.c.in 405e15e6a57a224af0f6ff014cb45cbb8123178fa1a6e5cfb39d3540389d9207 F src/sqlite.h.in 77f55bd1978a04a14db211732f0a609077cf60ba4ccf9baf39988f508945419c F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2215,8 +2215,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3b5ae21074958788b23ccf449e52fbbad1f81779e07a6ca62ad8395f88a37286 -R 5afd3bdce6fbcc9f56c686c2625824c5 +P 74bbb2b2b4507d9acbd91209a2ce341968e9ff64f3aebe9e817bfe488d39ae03 +R 9584e7093ca35da79a25d5e2b514ac01 U drh -Z a729cfecd90e8d587c0a925f42031223 +Z 9a391f06b77de429a8a012b5954b01a2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9f435ff8f9..24a6899959 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -74bbb2b2b4507d9acbd91209a2ce341968e9ff64f3aebe9e817bfe488d39ae03 +a9209519f612e66cfe11c89e70efd8285a0185ac0d3e5795846aafbd05d7a21f diff --git a/src/shell.c.in b/src/shell.c.in index 1c81a0bbab..25e3aad519 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -5041,10 +5041,11 @@ static const char *(azHelp[]) = { #ifndef SQLITE_SHELL_FIDDLE ".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE", " If FILE begins with '|' then open as a pipe", - " --bom Put a UTF8 byte-order mark at the beginning", - " -e Send output to the system text editor", - " -w Send output as HTML to a web browser (same as \".www\")", - " -x Send output as CSV to a spreadsheet (same as \".excel\")", + " --bom Put a UTF8 byte-order mark at the beginning", + " -e Send output to the system text editor", + " --plain Use text/plain output instead of HTML for -w option", + " -w Send output as HTML to a web browser (same as \".www\")", + " -x Send output as CSV to a spreadsheet (same as \".excel\")", /* Note that .open is (partially) available in WASM builds but is ** currently only intended to be used by the fiddle tool, not ** end users, so is "undocumented." */ @@ -5067,6 +5068,8 @@ static const char *(azHelp[]) = { " Options:", " --bom Prefix output with a UTF8 byte-order mark", " -e Send output to the system text editor", + " --plain Use text/plain for -w option", + " -w Send output to a web browser", " -x Send output as CSV to a spreadsheet", #endif ".parameter CMD ... Manage SQL parameter bindings", @@ -5182,6 +5185,7 @@ static const char *(azHelp[]) = { " Negative values right-justify", #ifndef SQLITE_SHELL_FIDDLE ".www Display output of the next command in web browser", + " --plain Show results as text/plain, not as HTML", #endif }; @@ -9908,6 +9912,7 @@ static int do_meta_command(char *zLine, ShellState *p){ int i; int eMode = 0; int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */ + int bPlain = 0; /* --plain option */ static const char *zBomUtf8 = "\xef\xbb\xbf"; const char *zBom = 0; @@ -9927,6 +9932,8 @@ static int do_meta_command(char *zLine, ShellState *p){ if( z[1]=='-' ) z++; if( cli_strcmp(z,"-bom")==0 ){ zBom = zBomUtf8; + }else if( cli_strcmp(z,"-plain")==0 ){ + bPlain = 1; }else if( c=='o' && cli_strcmp(z,"-x")==0 ){ eMode = 'x'; /* spreadsheet */ }else if( c=='o' && cli_strcmp(z,"-e")==0 ){ @@ -9982,7 +9989,7 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( eMode=='w' ){ /* web-browser mode. */ newTempFile(p, "html"); - p->mode = MODE_Www; + if( !bPlain ) p->mode = MODE_Www; bTxtMode = 1; }else{ /* text editor mode */ @@ -10019,6 +10026,12 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = 1; } else { output_redir(p, pfFile); + if( bPlain && eMode=='w' ){ + sqlite3_fputs( + "\n\n\n", + pfFile + ); + } if( zBom ) sqlite3_fputs(zBom, pfFile); sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile); }