mirror of
https://github.com/sqlite/sqlite.git
synced 2025-05-28 12:41:31 +03:00
CLI to have "undocumented" dot-commands, not usually shown by .help
FossilOrigin-Name: 17f5dd2d2ae02a95180b9208b7de805922ba20271d3263e3193f0d46f4ec324c
This commit is contained in:
parent
223c6b48a9
commit
022a042897
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C The\ssqlite_stat4.idx\sfield\sis\scase\sinsensitive.\s\sIt\sshould\swork\seven\sif\nsome\sentries\suse\sa\sdifferent\scase\sthan\sothers.\s\sFix\sfor\n[forum:/info/6c118daad0f1f5ef|forum\spost\s6c118daad0f1f5ef].
|
||||
D 2023-04-22T22:32:19.521
|
||||
C CLI\sto\shave\s"undocumented"\sdot-commands,\snot\susually\sshown\sby\s.help
|
||||
D 2023-04-23T00:12:23.282
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -633,7 +633,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c f879cef11c462a2c37a8c906932781e384c3bb32042c355a704a043029c90d27
|
||||
F src/shell.c.in 0bf660f2ed0cedb63ed2b029935fd758b3abe68369a08bdc8ad26dd4b402e3a7
|
||||
F src/shell.c.in e4762c17316110d4b65afac3572a4d134539a4178ac2afe4821de23f509a728f
|
||||
F src/sqlite.h.in 4fff9c6cc5d4cbba9532a668112efb6dc469c425e1a2196664d7c07d508363ef
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
|
||||
@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 33681ff3d29c9f096dbd8c5d885993f780e93974a7653adc00fa41a158356d7c
|
||||
R 01b63f06161c14df16351e4095f8f08a
|
||||
U drh
|
||||
Z c0a9a444e995bf31a24cacb99b3324ee
|
||||
P f097ca70b5b967d1aadebd74ac5020813e00b7c30cc543814dbf5f359d1328f1
|
||||
R 62624db0a9c4c2fd6a3100f573d3f96a
|
||||
U larrybr
|
||||
Z 113b1c901dbc06332b9973dc3c2cd6a4
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
f097ca70b5b967d1aadebd74ac5020813e00b7c30cc543814dbf5f359d1328f1
|
||||
17f5dd2d2ae02a95180b9208b7de805922ba20271d3263e3193f0d46f4ec324c
|
@ -4776,13 +4776,13 @@ static const char *(azHelp[]) = {
|
||||
" input text.",
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_TEST_CONTROL
|
||||
".imposter INDEX TABLE Create imposter table TABLE on index INDEX",
|
||||
",imposter INDEX TABLE Create imposter table TABLE on index INDEX",
|
||||
#endif
|
||||
".indexes ?TABLE? Show names of indexes",
|
||||
" If TABLE is specified, only show indexes for",
|
||||
" tables matching TABLE using the LIKE operator.",
|
||||
#ifdef SQLITE_ENABLE_IOTRACE
|
||||
".iotrace FILE Enable I/O diagnostic logging to FILE",
|
||||
",iotrace FILE Enable I/O diagnostic logging to FILE",
|
||||
#endif
|
||||
".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT",
|
||||
".lint OPTIONS Report potential schema issues.",
|
||||
@ -4891,7 +4891,7 @@ static const char *(azHelp[]) = {
|
||||
" Options:",
|
||||
" --indent Try to pretty-print the schema",
|
||||
" --nosys Omit objects whose names start with \"sqlite_\"",
|
||||
".selftest ?OPTIONS? Run tests defined in the SELFTEST table",
|
||||
",selftest ?OPTIONS? Run tests defined in the SELFTEST table",
|
||||
" Options:",
|
||||
" --init Create a new SELFTEST table",
|
||||
" -v Verbose output",
|
||||
@ -4933,9 +4933,9 @@ static const char *(azHelp[]) = {
|
||||
#endif
|
||||
".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
|
||||
#ifndef SQLITE_SHELL_FIDDLE
|
||||
".testcase NAME Begin redirecting output to 'testcase-out.txt'",
|
||||
",testcase NAME Begin redirecting output to 'testcase-out.txt'",
|
||||
#endif
|
||||
".testctrl CMD ... Run various sqlite3_test_control() operations",
|
||||
",testctrl CMD ... Run various sqlite3_test_control() operations",
|
||||
" Run \".testctrl\" with no arguments for details",
|
||||
".timeout MS Try opening locked tables for MS milliseconds",
|
||||
".timer on|off Turn SQL timer on or off",
|
||||
@ -4987,16 +4987,41 @@ static int showHelp(FILE *out, const char *zPattern){
|
||||
|| cli_strcmp(zPattern,"-all")==0
|
||||
|| cli_strcmp(zPattern,"--all")==0
|
||||
){
|
||||
/* Show all commands, but only one line per command */
|
||||
if( zPattern==0 ) zPattern = "";
|
||||
enum HelpWanted { HW_NoCull = 0, HW_SummaryOnly = 1, HW_Undoc = 2 };
|
||||
enum HelpHave { HH_Undoc = 2, HH_Summary = 1, HH_More = 0 };
|
||||
/* Show all or most commands
|
||||
** *zPattern==0 => summary of documented commands only
|
||||
** *zPattern=='0' => whole help for undocumented commands
|
||||
** Otherwise => whole help for documented commands
|
||||
*/
|
||||
enum HelpWanted hw = HW_SummaryOnly;
|
||||
if( zPattern!=0 ){
|
||||
hw = (*zPattern=='0')? HW_NoCull|HW_Undoc : HW_NoCull;
|
||||
}
|
||||
enum HelpHave hh = HH_More;
|
||||
for(i=0; i<ArraySize(azHelp); i++){
|
||||
if( azHelp[i][0]=='.' || zPattern[0] ){
|
||||
utf8_printf(out, "%s\n", azHelp[i]);
|
||||
n++;
|
||||
switch( azHelp[i][0] ){
|
||||
case ',':
|
||||
hh = HH_Summary|HH_Undoc;
|
||||
break;
|
||||
case '.':
|
||||
hh = HH_Summary;
|
||||
break;
|
||||
default:
|
||||
hh &= ~HH_Summary;
|
||||
break;
|
||||
}
|
||||
if( ((hw^hh)&HH_Undoc)==0 ){
|
||||
if( (hh&HH_Summary)!=0 ){
|
||||
utf8_printf(out, ".%s\n", azHelp[i]+1);
|
||||
++n;
|
||||
}else if( (hw&HW_SummaryOnly)==0 ){
|
||||
utf8_printf(out, "%s\n", azHelp[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
/* Look for commands that for which zPattern is an exact prefix */
|
||||
/* Seek documented commands for which zPattern is an exact prefix */
|
||||
zPat = sqlite3_mprintf(".%s*", zPattern);
|
||||
shell_check_oom(zPat);
|
||||
for(i=0; i<ArraySize(azHelp); i++){
|
||||
@ -5009,24 +5034,28 @@ static int showHelp(FILE *out, const char *zPattern){
|
||||
sqlite3_free(zPat);
|
||||
if( n ){
|
||||
if( n==1 ){
|
||||
/* when zPattern is a prefix of exactly one command, then include the
|
||||
** details of that command, which should begin at offset j */
|
||||
while( j<ArraySize(azHelp)-1 && azHelp[j][0]!='.' ){
|
||||
/* when zPattern is a prefix of exactly one command, then include
|
||||
** the details of that command, which should begin at offset j */
|
||||
while( j<ArraySize(azHelp)-1 && azHelp[j][0]==' ' ){
|
||||
utf8_printf(out, "%s\n", azHelp[j]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
/* Look for commands that contain zPattern anywhere. Show the complete
|
||||
** text of all commands that match. */
|
||||
/* Look for documented commands that contain zPattern anywhere.
|
||||
** Show complete text of all documented commands that match. */
|
||||
zPat = sqlite3_mprintf("%%%s%%", zPattern);
|
||||
shell_check_oom(zPat);
|
||||
for(i=0; i<ArraySize(azHelp); i++){
|
||||
if( azHelp[i][0]==',' ){
|
||||
while( i<ArraySize(azHelp)-1 && azHelp[i+1][0]==' ' ) ++i;
|
||||
continue;
|
||||
}
|
||||
if( azHelp[i][0]=='.' ) j = i;
|
||||
if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){
|
||||
utf8_printf(out, "%s\n", azHelp[j]);
|
||||
while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]!='.' ){
|
||||
while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]==' ' ){
|
||||
j++;
|
||||
utf8_printf(out, "%s\n", azHelp[j]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user