]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/LeiEditSearch.pm
get rid of unnecessary bytes::length usage
[public-inbox.git] / lib / PublicInbox / LeiEditSearch.pm
1 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # "lei edit-search" edit a saved search following "lei q --save"
5 package PublicInbox::LeiEditSearch;
6 use strict;
7 use v5.10.1;
8 use PublicInbox::LeiSavedSearch;
9 use PublicInbox::LeiUp;
10
11 sub lei_edit_search {
12         my ($lei, $out) = @_;
13         my $lss = PublicInbox::LeiSavedSearch->up($lei, $out) or return;
14         my @cmd = (qw(git config --edit -f), $lss->{'-f'});
15         $lei->qerr("# spawning @cmd");
16         $lss->edit_begin($lei);
17         # run in script/lei foreground
18         require PublicInbox::PktOp;
19         my ($op_c, $op_p) = PublicInbox::PktOp->pair;
20         # $op_p will EOF when $EDITOR is done
21         $op_c->{ops} = { '' => [$lss->can('edit_done'), $lss, $lei] };
22         $lei->send_exec_cmd([ @$lei{qw(0 1 2)}, $op_p->{op_p} ], \@cmd, {});
23 }
24
25 *_complete_edit_search = \&PublicInbox::LeiUp::_complete_up;
26
27 1;