diff options
author | Eric Wong <e@80x24.org> | 2023-03-23 21:45:45 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-03-25 21:03:53 +0000 |
commit | 2dd3cec8783700f061a0c9b69e329918a4f5cccd (patch) | |
tree | 14eb91e32413f0006706ca0557309b4a37ff6139 /lib/PublicInbox/LeiForgetExternal.pm | |
parent | 2021c73236b0c7d9f4e6ad90291c35138c9ef75e (diff) | |
download | public-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.pm | 8 |
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; |