about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiForgetExternal.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-03-23 21:45:45 +0000
committerEric Wong <e@80x24.org>2023-03-25 21:03:53 +0000
commit2dd3cec8783700f061a0c9b69e329918a4f5cccd (patch)
tree14eb91e32413f0006706ca0557309b4a37ff6139 /lib/PublicInbox/LeiForgetExternal.pm
parent2021c73236b0c7d9f4e6ad90291c35138c9ef75e (diff)
downloadpublic-inbox-2dd3cec8783700f061a0c9b69e329918a4f5cccd.tar.gz
This fixes completions of labels (`+L:' for `lei import' and
`L:' for `lei q') so they can appear anywhere in the
command-line.

I mainly wanted this for `lei import $URL +L:label', but
this also fixes `lei forget-external' completions for URLs
(which involve colons).
Diffstat (limited to 'lib/PublicInbox/LeiForgetExternal.pm')
-rw-r--r--lib/PublicInbox/LeiForgetExternal.pm8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/PublicInbox/LeiForgetExternal.pm b/lib/PublicInbox/LeiForgetExternal.pm
index 07f0ac80..39bfc60b 100644
--- a/lib/PublicInbox/LeiForgetExternal.pm
+++ b/lib/PublicInbox/LeiForgetExternal.pm
@@ -32,14 +32,10 @@ sub lei_forget_external {
 sub _complete_forget_external {
         my ($lei, @argv) = @_;
         my $cfg = $lei->_lei_cfg or return ();
-        my ($cur, $re, $match_cb) = $lei->complete_url_prepare(\@argv);
-        # FIXME: bash completion off "http:" or "https:" when the last
-        # character is a colon doesn't work properly even if we're
-        # returning "//$HTTP_HOST/$PATH_INFO/", not sure why, could
-        # be a bash issue.
+        my ($pfx, $cur, $match_cb) = $lei->complete_url_prepare(\@argv);
         map {
                 $match_cb->(substr($_, length('external.')));
-        } grep(/\Aexternal\.$re\Q$cur/, @{$cfg->{-section_order}});
+        } grep(/\Aexternal\.\Q$pfx$cur/, @{$cfg->{-section_order}});
 }
 
 1;