about summary refs log tree commit homepage
path: root/lib/PublicInbox/Config.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-16 16:10:35 -0700
committerEric Wong <e@80x24.org>2021-04-17 10:00:45 +0000
commit74c0a24d49855321883f23decd687a1a866df24e (patch)
treed832b2e99a364b98f258f845c29aa60c33e1492d /lib/PublicInbox/Config.pm
parent1e51bc86dcdc25363575f6e9b35d954c65dec795 (diff)
downloadpublic-inbox-74c0a24d49855321883f23decd687a1a866df24e.tar.gz
A user may wish to clobber/refine existing search parameters
by issuing "lei q --save" again.  Support that by overwriting
the lei.saved-search state file entirely.

We continue to preserve over.sqlite3 for deduplication purposes.

This way, we don't get something redundant like:

	[lei]
		q = term1
		q = term2
		q = term1
		q = term2
		q = term3

...whenever a user wants to refine their search.  Instead,
we'll just have:

	[lei]
		q = term1
		q = term2
		q = term3

On the second go.
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r--lib/PublicInbox/Config.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 26ac298e..603dad98 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -559,4 +559,13 @@ sub json {
         };
 }
 
+sub squote_maybe ($) {
+        my ($val) = @_;
+        if ($val =~ m{([^\w@\./,\%\+\-])}) {
+                $val =~ s/(['!])/'\\$1'/g; # '!' for csh
+                return "'$val'";
+        }
+        $val;
+}
+
 1;