]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the --color and --no-color options to the ".prompt" command of the CLI.
authordrh <>
Mon, 4 May 2026 12:58:05 +0000 (12:58 +0000)
committerdrh <>
Mon, 4 May 2026 12:58:05 +0000 (12:58 +0000)
FossilOrigin-Name: 1590b401ff0670b68910504c281e67ecae7ae357ba3ed65f96dabaabd7aaeb7f

manifest
manifest.uuid
src/shell.c.in

index 2309847f30cdbf430b68bc3ddbd8a2f3d6c8decd..a381d141fa8d7b10e0553159904c0f8a0a2fdfdd 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Honor\sthe\sNO_COLOR\senvironment\svariable.\s\sIf\sNO_COLOR\sis\sset\sand\nSQLITE_PS1\sand\sSQLITE_PS2\sare\snot\sset,\sthen\sthe\sdefault\sprompt\sis\nmonochrome\sand\sANSI\sescapes\sare\somitted.\s\sAlso\schange\sthe\sname\sof\nthe\sSQLITE_PS_NOANSI\scompile-time\soption\sto\sSQLITE_NO_COLOR.
-D 2026-05-04T10:14:13.819
+C Add\sthe\s--color\sand\s--no-color\soptions\sto\sthe\s".prompt"\scommand\sof\sthe\sCLI.
+D 2026-05-04T12:58:05.910
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -736,7 +736,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c fcc406bfb055bee9954ee77c023f4a2a66a24bcdf1573516a72280811a269c20
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
 F src/select.c 4c05cde130f26991b7411d8c6809e0630625e18078742c963a047b4b9cc01d49
-F src/shell.c.in 23c17a6f73d3fb3ed9e0ddcaa9994e8ad521ae9b5d1fb1d1bd8a7b5caa6c7940
+F src/shell.c.in 51167ca344ac180efcf6339353c11800981bed97f37c9b8d9e940e659b7d181f
 F src/sqlite.h.in 39d2e09114d2bdb7afd998f4a469c8f8cd065f8093835a7d0422f260fc78fb4f
 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
 F src/sqlite3ext.h 9788c301f95370fa30e808861f1d2e6f022a816ddbe2a4f67486784c1b31db2e
@@ -2203,8 +2203,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 2340cbbd230bdadedbb5d3eb9cfd287fd934e69ce5a2c989e141b0fc87b947aa
-R a6b0454e8c391a63932f36d2efa2f0e8
+P 7e4134e3ff1ca8712f5fc78fadae665549450988dc43af27c7fe0c77f10ce3fb
+R 296ec8aac52d0da7005ed766a61af159
 U drh
-Z 615ead25f324eae5ee6c5e7d8842ef22
+Z 194075414c72509e2dbf552752cfbeab
 # Remove this line to create a well-formed Fossil manifest.
index f9a45b04356fc1927b15cae55133824cfc97428a..a75288bca45b2d96cde18a953d001ab3b02bd0d0 100644 (file)
@@ -1 +1 @@
-7e4134e3ff1ca8712f5fc78fadae665549450988dc43af27c7fe0c77f10ce3fb
+1590b401ff0670b68910504c281e67ecae7ae357ba3ed65f96dabaabd7aaeb7f
index 350361a34e744b392e8a573929493f5a1a412342..a3aed5784d876258cb003fa3381d33f00e26e69f 100644 (file)
@@ -4334,6 +4334,9 @@ static const char *(azHelp[]) = {
 #endif
   ".prompt MAIN CONTINUE    Replace the standard prompts",
   "   --hard-reset              Unset SQLITE_PS1/2 and then --reset",
+#ifndef SQLITE_NO_COLOR
+  "   --no-color                Disable color prompts. Use --color to re-enable",
+#endif
   "   --reset                   Revert to default prompts",
   "   --show                    Show the current prompt strings",
   "   --                        No more options. Subsequent args are prompts",
@@ -11100,6 +11103,22 @@ static int do_meta_command(const char *zLine, ShellState *p){
           cli_printf(stdout,"Main prompt:  '%s'\n", prompt_string(p, 0));
           cli_printf(stdout,"Continuation: '%s'\n", prompt_string(p, 1));
         }else
+#ifndef SQLITE_NO_COLOR
+        if( strcmp(z,"-color")==0 ){
+#ifdef _WIN32
+          _putenv("NO_COLOR=");
+#else
+          unsetenv("NO_COLOR");
+#endif
+        }else
+        if( strcmp(z,"-no-color")==0 ){
+#ifdef _WIN32
+          _putenv("NO_COLOR=1");
+#else
+          setenv("NO_COLOR","1",1);
+#endif
+        }else
+#endif
         if( strcmp(z,"-")==0 ){
           noOpt = 1;
         }else