unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: RFC: lei q --include/-I and similar switch names
Date: Sun, 24 Jan 2021 21:33:47 -1000	[thread overview]
Message-ID: <20210125073347.GA15401@dcvr> (raw)

"add-external" sometimes feels like an unnecessary burden
for a one-off search, so it'd be nice to be able to search
an external once, or exclude certain externals.

I'm set on supporting "-I$DIR_OR_URL" since that's common
command-line usage for gcc/clang/tcc, perl, ruby to include
extra search paths for headers/modules.

--exclude is naturally the opposite of --include, and I don't
know if --exclude needs a short name.  "-v" (like "grep -v")
isn't available, but maybe "-X" works, since it's something we
can't pass from the CLI to curl.  We're not passing "-x" to
curl, either, but we pass "--proxy" through, of course.

I don't know if "--only" is a good name and don't know of any
common tools with similar functionality (but I know very little
in general :x).  "--exclusive" would be confusing with
"--exclude" and require more typing even with tab-completion.
If we use "--only", then we can use -O for --only since we can't
forward -O to curl, either...

Anyways here's the proposed Getopt::Long spec changes to think
about:

diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index effc6c52..a8f06e2c 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -85,6 +85,7 @@ our %CMD = ( # sorted in order of importance/use:
 'q' => [ 'SEARCH_TERMS...', 'search for messages matching terms', qw(
 	save-as=s output|mfolder|o=s format|f=s dedupe|d=s thread|t augment|a
 	sort|s=s reverse|r offset=i remote! local! external! pretty mua-cmd=s
+	include|I=s@ only|O=s@ exclude=s@
 	torsocks=s no-torsocks verbose|v since|after=s until|before=s),
 	PublicInbox::LeiQuery::curl_opt(), opt_dash('limit|n=i', '[0-9]+') ],
 

The trailing '@' means it's an array and can be specified more
than once, 's' means it's a string ('i' for integers), '=' means
it's a required arg (':' denotes optional args)

And I'll probably split date-time search switches so users can
choose either the easily-faked Date: header or difficult-to-fake
most-recent Received header.  Also, date-time searches will use
git's date parser, and not force users to use YYYYMMDD or similar.

             reply	other threads:[~2021-01-25  7:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  7:33 Eric Wong [this message]
2021-01-27  2:04 ` RFC: lei q --include/-I and similar switch names Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210125073347.GA15401@dcvr \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).