Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the --plain option to the ".www" dot-command. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | cli-stdlib |
Files: | files | file ages | folders |
SHA3-256: |
a9209519f612e66cfe11c89e70efd828 |
User & Date: | drh 2024-09-25 15:55:52.425 |
Context
2024-09-25
| ||
16:11 | Always show HTML table headers in ".www" output mode. (check-in: 660ca5ce66 user: drh tags: cli-stdlib) | |
15:55 | Add the --plain option to the ".www" dot-command. (check-in: a9209519f6 user: drh tags: cli-stdlib) | |
15:26 | Have the zipfile and fileio extensions use sqlite3_stdio.c when it is available - such as when those extensions are preloaded into the CLI. (check-in: 74bbb2b2b4 user: drh tags: cli-stdlib) | |
Changes
Changes to src/shell.c.in.
︙ | ︙ | |||
5037 5038 5039 5040 5041 5042 5043 | #ifndef SQLITE_SHELL_FIDDLE ".nonce STRING Suspend safe mode for one command if nonce matches", #endif ".nullvalue STRING Use STRING in place of NULL values", #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", | | | > | | | 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 | #ifndef SQLITE_SHELL_FIDDLE ".nonce STRING Suspend safe mode for one command if nonce matches", #endif ".nullvalue STRING Use STRING in place of NULL values", #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", " --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." */ ".open ?OPTIONS? ?FILE? Close existing database and reopen FILE", " Options:", " --append Use appendvfs to append database to the end of FILE", #endif |
︙ | ︙ | |||
5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 | " --zip FILE is a ZIP archive", #ifndef SQLITE_SHELL_FIDDLE ".output ?FILE? Send output to FILE or stdout if FILE is omitted", " If FILE begins with '|' then open it as a pipe.", " Options:", " --bom Prefix output with a UTF8 byte-order mark", " -e Send output to the system text editor", " -x Send output as CSV to a spreadsheet", #endif ".parameter CMD ... Manage SQL parameter bindings", " clear Erase all bindings", " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", | > > | 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 | " --zip FILE is a ZIP archive", #ifndef SQLITE_SHELL_FIDDLE ".output ?FILE? Send output to FILE or stdout if FILE is omitted", " If FILE begins with '|' then open it as a pipe.", " 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", " clear Erase all bindings", " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", |
︙ | ︙ | |||
5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 | ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", ".width NUM1 NUM2 ... Set minimum column widths for columnar output", " Negative values right-justify", #ifndef SQLITE_SHELL_FIDDLE ".www Display output of the next command in web browser", #endif }; /* ** Output help text. ** ** zPattern describes the set of commands for which help text is provided. | > | 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 | ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", ".width NUM1 NUM2 ... Set minimum column widths for columnar output", " 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 }; /* ** Output help text. ** ** zPattern describes the set of commands for which help text is provided. |
︙ | ︙ | |||
9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 | || (c=='w' && n==3 && cli_strcmp(azArg[0],"www")==0) ){ char *zFile = 0; int bTxtMode = 0; int i; int eMode = 0; int bOnce = 0; /* 0: .output, 1: .once, 2: .excel/.www */ static const char *zBomUtf8 = "\xef\xbb\xbf"; const char *zBom = 0; failIfSafeMode(p, "cannot run .%s in safe mode", azArg[0]); if( c=='e' ){ eMode = 'x'; bOnce = 2; }else if( c=='w' ){ eMode = 'w'; bOnce = 2; }else if( cli_strncmp(azArg[0],"once",n)==0 ){ bOnce = 1; } for(i=1; i<nArg; i++){ char *z = azArg[i]; if( z[0]=='-' ){ if( z[1]=='-' ) z++; if( cli_strcmp(z,"-bom")==0 ){ zBom = zBomUtf8; }else if( c=='o' && cli_strcmp(z,"-x")==0 ){ eMode = 'x'; /* spreadsheet */ }else if( c=='o' && cli_strcmp(z,"-e")==0 ){ eMode = 'e'; /* text editor */ }else if( c=='o' && cli_strcmp(z,"-w")==0 ){ eMode = 'w'; /* Web browser */ }else{ | > > > | 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 | || (c=='w' && n==3 && cli_strcmp(azArg[0],"www")==0) ){ char *zFile = 0; int bTxtMode = 0; 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; failIfSafeMode(p, "cannot run .%s in safe mode", azArg[0]); if( c=='e' ){ eMode = 'x'; bOnce = 2; }else if( c=='w' ){ eMode = 'w'; bOnce = 2; }else if( cli_strncmp(azArg[0],"once",n)==0 ){ bOnce = 1; } for(i=1; i<nArg; i++){ char *z = azArg[i]; if( z[0]=='-' ){ 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 ){ eMode = 'e'; /* text editor */ }else if( c=='o' && cli_strcmp(z,"-w")==0 ){ eMode = 'w'; /* Web browser */ }else{ |
︙ | ︙ | |||
9978 9979 9980 9981 9982 9983 9984 | #ifdef _WIN32 zBom = zBomUtf8; /* Always include the BOM on Windows, as Excel does ** not work without it. */ #endif }else if( eMode=='w' ){ /* web-browser mode. */ newTempFile(p, "html"); | | | 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 | #ifdef _WIN32 zBom = zBomUtf8; /* Always include the BOM on Windows, as Excel does ** not work without it. */ #endif }else if( eMode=='w' ){ /* web-browser mode. */ newTempFile(p, "html"); if( !bPlain ) p->mode = MODE_Www; bTxtMode = 1; }else{ /* text editor mode */ newTempFile(p, "txt"); bTxtMode = 1; } sqlite3_free(zFile); |
︙ | ︙ | |||
10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 | if( pfFile==0 ){ if( cli_strcmp(zFile,"off")!=0 ){ sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile); } rc = 1; } else { output_redir(p, pfFile); if( zBom ) sqlite3_fputs(zBom, pfFile); sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile); } } sqlite3_free(zFile); }else #endif /* !defined(SQLITE_SHELL_FIDDLE) */ | > > > > > > | 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 | if( pfFile==0 ){ if( cli_strcmp(zFile,"off")!=0 ){ sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile); } rc = 1; } else { output_redir(p, pfFile); if( bPlain && eMode=='w' ){ sqlite3_fputs( "<!DOCTYPE html>\n<BODY>\n<PLAINTEXT>\n", pfFile ); } if( zBom ) sqlite3_fputs(zBom, pfFile); sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile); } } sqlite3_free(zFile); }else #endif /* !defined(SQLITE_SHELL_FIDDLE) */ |
︙ | ︙ |