Saisons/Launcher.pm

filter: Statementstmt 31.8% 7 / 22 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 1 totaltotal 22.5% 9 / 40 CC 7 SCAR 36.8
CC
7
Cov
21%
launch_cmd
56.0
_applescript_quote
2.0
BEGIN
1.0
CRAP 39.6
« Saisons/Adapter/Claude.pm ↑ Summary Saisons/Adapter/Gemini.pm »
1 package App::Saisons::Launcher;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 0 ▶sub launch_cmd {
Subroutine launch_cmd: not called CC=7 SCAR=40.3
Pod undocumented
5 0 my ($cmd, $cwd, $launcher, $title) = @_;
6 0 ▶ $title //= 'saisons';
Condition0%0/2
$title //= "saisons"
l!l
00
MC/DC0%0/1
$title //= "saisons"
$title
Truth table0%0/2
A
A= $title
Aresult
11
00
7 0 ▶ if ($launcher eq 'tmux') {
Branch: 5 branches
BranchTrueFalseTotal
if ($launcher eq 'tmux') { } 0 0 0
elsif ($launcher eq 'screen') { } 0 0 0
elsif ($launcher eq 'gnome-terminal') { } 0 0 0
elsif ($launcher eq 'iterm') { } 0 0 0
elsif ($launcher eq 'terminal-app') { } 0 0 0
8 0 system('tmux', 'new-window', '-c', $cwd, $cmd);
9 }
10 elsif ($launcher eq 'screen') {
11 0 system('screen', '-X', 'screen', '-t', substr($title, 0, 20),
12 'bash', '-c', "$cmd; exec bash");
13 }
14 elsif ($launcher eq 'gnome-terminal') {
15 0 system('gnome-terminal', '--tab', "--working-directory=$cwd",
16 '--', 'bash', '--login', '-c', $cmd);
17 }
18 elsif ($launcher eq 'iterm') {
19 0 my $escaped = _applescript_quote($cmd);
20 0 system('osascript', '-e', qq{tell application "iTerm2"\ntell current window\ncreate tab with default profile\ntell current session of current tab\nwrite text $escaped\nend tell\nend tell\nend tell});
21 }
22 elsif ($launcher eq 'terminal-app') {
23 0 my $escaped = _applescript_quote($cmd);
24 0 system('osascript', '-e', qq{tell application "Terminal"\ndo script $escaped\nactivate\nend tell});
25 }
26 else {
27 0 system('bash', '-c', $cmd);
28 }
29 }
30 0 ▶sub _applescript_quote {
Subroutine _applescript_quote: not called CC=1 SCAR=6.9
31 0 my ($str) = @_;
32 0 $str =~ s/\\/\\\\/g;
33 0 $str =~ s/"/\\"/g;
34 0 return qq{"$str"};
35 }
36 2 1;
« Saisons/Adapter/Claude.pm ↑ Summary Saisons/Adapter/Gemini.pm »