blib/lib/Complete/XWindowManager.pm

filter: Statementstmt 56.7% 21 / 37 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 55.1% 27 / 49 CC 3 SCAR 12.5
CC
3
Cov
51%
complete_xwm_window_id
6.0
complete_xwm_window_title
6.0
BEGIN
1.0
CRAP 3.5
↑ Summary
1 package Complete::XWindowManager;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 1 our $DATE = '2026-05-29'; # DATE
11 1 our $DIST = 'Complete-XWindowManager'; # DIST
12 1 our $VERSION = '0.001'; # VERSION
13  
14 1 our @EXPORT_OK = qw(
15 complete_window_id
16 complete_window_title
17 );
18  
19 1 our %SPEC;
20  
21 1 $SPEC{':package'} = {
22 v => 1.1,
23 summary => 'Completion routines related to X Window Manager',
24 };
25  
26 $SPEC{complete_xwm_window_id} = {
27 1 v => 1.1,
28 summary => 'Complete from a list of existing window IDs',
29 args => {
30 word => {
31 schema => 'str*',
32 req => 1,
33 pos => 0,
34 },
35 },
36 result_naked => 1,
37 };
38 0 ▶sub complete_xwm_window_id {
Subroutine complete_xwm_window_id: not called CC=2 SCAR=17.9
Pod documented
39 0 require Complete::Util;
40 0 require Desktop::XWindowManager::Util;
41  
42 0 my %args = @_;
43  
44 0 my $res = Desktop::XWindowManager::Util::list_xwm_windows(detail=>1);
45 0 ▶ return {message=>"Can't list windows: $res->[0] - $res->[1]"}
Branch: 1 branch
BranchTrueFalseTotal
unless $res->[0] == 200 0 0 0
46 unless $res->[0] == 200;
47  
48 Complete::Util::complete_array_elem(
49 word => $args{word},
50 0 array => [map { +{word=>$_->{id}, summary=>$_->{title}} } @{ $res->[2] }],
51 );
52 }
53  
54 $SPEC{complete_xwm_window_title} = {
55 1 v => 1.1,
56 summary => 'Complete from a list of existing window titles',
57 args => {
58 word => {
59 schema => 'str*',
60 req => 1,
61 pos => 0,
62 },
63 },
64 result_naked => 1,
65 };
66 0 ▶sub complete_xwm_window_title {
Subroutine complete_xwm_window_title: not called CC=2 SCAR=17.9
Pod documented
67 0 require Complete::Util;
68 0 require Desktop::XWindowManager::Util;
69  
70 0 my %args = @_;
71  
72 0 my $res = Desktop::XWindowManager::Util::list_xwm_windows(detail=>1);
73 0 ▶ return {message=>"Can't list windows: $res->[0] - $res->[1]"}
Branch: 1 branch
BranchTrueFalseTotal
unless $res->[0] == 200 0 0 0
74 unless $res->[0] == 200;
75  
76 Complete::Util::complete_array_elem(
77 word => $args{word},
78 0 array => [map {$_->{title}} @{ $res->[2] }],
79 );
80 }
81  
82 1 1;
83 # ABSTRACT: Completion routines related to X Window Manager
84  
85 __END__
↑ Summary