From 74c0a24d49855321883f23decd687a1a866df24e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 16 Apr 2021 16:10:35 -0700 Subject: lei q --save: clobber config file on repeats 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. --- lib/PublicInbox/Config.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/PublicInbox/Config.pm') 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; -- cgit v1.2.3-24-ge0c7