From 843418ae70c0a88ed7f5a5bd8b78fadde8427725 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 24 Nov 2025 12:27:18 +0000 Subject: [PATCH] In the CLI on the ".mode" command, replace the recently added --no-limits option with "--limits L,C". And add --sw as an alias for --screenwidth. FossilOrigin-Name: caefe4c746599b22aec446f3aeb296e53edaf8c54f8ae803381e8c21d5e29ab4 --- manifest | 17 ++++++-------- manifest.uuid | 2 +- src/shell.c.in | 62 +++++++++++++++++++++++++++++++------------------- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/manifest b/manifest index fb20827ee9..fb61cd770b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sthe\sthe\sSQLITE_SYNC_DATAONLY\sflag\sfrom\sthe\score\son\sthe\sgrounds\sthat\sit\sis\snot\scurrently\sused\sby\seither\sbuilt-in\sVFS\sand\sis\stherefore\suntested. -D 2025-11-24T11:22:56.683 +C In\sthe\sCLI\son\sthe\s".mode"\scommand,\sreplace\sthe\srecently\sadded\s--no-limits\soption\swith\n"--limits\sL,C".\s\sAnd\sadd\s--sw\sas\san\salias\sfor\s--screenwidth. +D 2025-11-24T12:27:18.181 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -735,7 +735,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a -F src/shell.c.in 7f4a56ac62b5030755e72c5a9598b45782a0deccba350605b13d6d7b48e58b2d +F src/shell.c.in bc2185e0e988f93643dbaac3c8f190b3687475cd7ac802c035d20347b8e27fbb F src/sqlite.h.in b5b2450724c9aa2d7ae2861c881385bc21ba940c79122c893f5ae9bb36ad10dd F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998 @@ -2179,11 +2179,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P de27d2d3f2353309227b4d5f77eff76c108c094b61ac59f5a769229a084f2567 -R b3a6bdd7591660f0d3db476c840596b8 -T *branch * remove-sync-dataonly -T *sym-remove-sync-dataonly * -T -sym-trunk * -U dan -Z 1d7edb159c9d5f32f5cc7510cd06382b +P ff2065b533769cbf5278d13d09ffa93a7a0f841b1b59b6be0e5f27e3d1c341d0 +R 628a0162ba8f0d8ab2de4d5bcae00f5f +U drh +Z 990cca7d1ccfde0bfbdaf6f519eba45c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 08a2b8ad65..3e0589cd5e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ff2065b533769cbf5278d13d09ffa93a7a0f841b1b59b6be0e5f27e3d1c341d0 +caefe4c746599b22aec446f3aeb296e53edaf8c54f8ae803381e8c21d5e29ab4 diff --git a/src/shell.c.in b/src/shell.c.in index 1be0db50e3..bce4cde190 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -7653,9 +7653,9 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** ** USAGE: .mode [MODE] [OPTIONS] ** -** Change the output mode to MODE and/or apply OPTIONS to the -** output mode. If no arguments, show the current output mode -** and relevant options. +** Change the output mode to MODE and/or apply OPTIONS to the output mode. +** Arguments are processed from left to right. If no arguments, show the +** current output mode and relevant options. ** ** Options: ** --align STRING Set the alignment of text in columnar modes @@ -7674,9 +7674,9 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** any single SQL value to N. Longer values are ** truncated. Zero means "no limit". Only works ** in "line" mode and in columnar modes. +** --limits L,C Shorthand for "--linelimit L --charlimit C". +** Or "off" to mean "0,0". Or "on" for "5,300". ** --list List available modes -** --no-limits Shorthand to turn off --linelimit, --charlimit, -** and --screenwidth. ** --null STRING Render SQL NULL values as the given string ** --once Setting changes to the right are reverted after ** the next SQL command. @@ -7686,7 +7686,7 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** "on and "sql" are synonyms. ** --reset Changes all mode settings back to their default. ** --rowsep STRING Use STRING as the row separator -** --screenwidth N Declare the screen width of the output device +** --sw|--screenwidth N Declare the screen width of the output device ** to be N characters. An attempt may be made to ** wrap output text to fit within this limit. Zero ** means "no limit". Or N can be "auto" to set the @@ -7694,7 +7694,7 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** --tablename NAME Set the name of the table for "insert" mode. ** --tag NAME Save mode to the left as NAME. ** --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON. -** --title ARG Whether or not to show column headers, and if so +** --title ARG Whether or not to show column headers, and if so ** how to encode them. ARG can be "off", "on", ** "sql", "csv", "html", "tcl", or "json". ** -v|--verbose Verbose output @@ -7798,11 +7798,10 @@ static int dotCmdMode(ShellState *p){ }else if( optionMatch(z,"escape") ){ /* See similar code at tag-20250224-1 */ char *zErr = 0; - if( i+1>=nArg ){ - dotCmdError(p, i, "missing argument", 0); + if( (++i)>=nArg ){ + dotCmdError(p, i-1, "missing argument", 0); return 1; - } - i++; /* 0 1 2 <-- One less than QRF_ESC_ */ + } /* 0 1 2 <-- One less than QRF_ESC_ */ k = pickStr(azArg[i],&zErr,"off","ascii","symbol",""); if( k<0 ){ dotCmdError(p, i, "unknown escape type", "%s", zErr); @@ -7811,6 +7810,30 @@ static int dotCmdMode(ShellState *p){ } p->mode.spec.eEsc = k+1; chng = 1; + }else if( optionMatch(z,"limits") ){ + if( (++i)>=nArg ){ + dotCmdError(p, i-1, "missing argument", 0); + return 1; + } + k = pickStr(azArg[i],0,"on","off",""); + if( k==0 ){ + p->mode.spec.nLineLimit = 5; + p->mode.spec.nCharLimit = 300; + }else if( k==1 ){ + p->mode.spec.nLineLimit = 0; + p->mode.spec.nCharLimit = 0; + }else{ + int L, C; + int nNum = sscanf(azArg[i], "%d,%d", &L, &C); + if( nNum!=2 || L<0 || C<0 ){ + dotCmdError(p, i, "bad argument", "Should be \"L,C\" where L and C" + " are unsigned integers"); + return 1; + } + p->mode.spec.nLineLimit = L; + p->mode.spec.nCharLimit = C; + } + chng = 1; }else if( optionMatch(z,"list") ){ int ii; cli_puts("available modes:", p->out); @@ -7831,12 +7854,6 @@ static int dotCmdMode(ShellState *p){ p->mode.spec.eText = QRF_TEXT_Plain; p->mode.spec.eBlob = QRF_BLOB_Text; chng = 1; - }else if( optionMatch(z,"no-limits") ){ - p->mode.spec.nLineLimit = 0; - p->mode.spec.nCharLimit = 0; - p->mode.spec.nScreenWidth = 0; - p->mode.bAutoScreenWidth = 0; - chng = 1; }else if( optionMatch(z,"quote") ){ if( i+1mode.eMode; modeFree(&p->mode); modeChange(p, saved_eMode); - }else if( optionMatch(z,"screenwidth") ){ - if( i+1>=nArg ){ - dotCmdError(p, i, "missing argument", 0); + }else if( optionMatch(z,"screenwidth") || optionMatch(z,"sw") ){ + if( (++i)>=nArg ){ + dotCmdError(p, i-1, "missing argument", 0); return 1; } - k = pickStr(azArg[i+1],0,"off","auto",""); + k = pickStr(azArg[i],0,"off","auto",""); if( k==0 ){ p->mode.bAutoScreenWidth = 0; p->mode.spec.nScreenWidth = 0; }else if( k==1 ){ p->mode.bAutoScreenWidth = 1; }else{ - i64 w = integerValue(azArg[i+1]); + i64 w = integerValue(azArg[i]); p->mode.bAutoScreenWidth = 0; if( w<0 ) w = 0; if( w>QRF_MAX_WIDTH ) w = QRF_MAX_WIDTH; p->mode.spec.nScreenWidth = w; } - i++; chng = 1; }else if( optionMatch(z,"tag") ){ size_t nByte; -- 2.47.3