line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::EditorTools::Command::InstallEmacs; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Install emacs bindings for App::EditorTools |
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
51914
|
use strict; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
284
|
|
6
|
7
|
|
|
7
|
|
41
|
use warnings; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
242
|
|
7
|
7
|
|
|
7
|
|
5235
|
use parent 'App::EditorTools::CommandBase::Install'; |
|
7
|
|
|
|
|
2181
|
|
|
7
|
|
|
|
|
38
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#use App::EditorTools -command; |
10
|
7
|
|
|
7
|
|
6795
|
use File::HomeDir; |
|
7
|
|
|
|
|
47398
|
|
|
7
|
|
|
|
|
2383
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
13
|
|
|
|
|
|
|
|
14
|
21
|
|
|
21
|
1
|
73381
|
sub command_names { 'install-emacs' } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub opt_spec { |
17
|
|
|
|
|
|
|
return ( |
18
|
5
|
|
|
5
|
1
|
80
|
[ "local|l", "Install the emacs script for the user (~/.emacs.d/)" ], |
19
|
|
|
|
|
|
|
[ "dest|d=s", "Full path to install the script" ], |
20
|
|
|
|
|
|
|
[ "print|p", "Print the script to STDOUT" ], |
21
|
|
|
|
|
|
|
[ "dryrun|n", "Print where the script would be installed" ], |
22
|
|
|
|
|
|
|
## [ "global|g", "Install the script globally (/usr/share/)" ], |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub validate_args { |
27
|
5
|
|
|
5
|
1
|
6765
|
my ( $self, $opt, $args ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
5
|
100
|
|
|
|
36
|
$self->_confirm_one_opt($opt) |
30
|
|
|
|
|
|
|
or $self->usage_error( |
31
|
|
|
|
|
|
|
"Options --local, --global, --dest and --print cannot be combined"); |
32
|
|
|
|
|
|
|
|
33
|
4
|
100
|
|
|
|
18
|
if ( !$opt->{dest} ) { |
34
|
3
|
50
|
|
|
|
22
|
if ( $opt->{global} ) { |
|
|
100
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
$self->usage_error("--global flag is not implemented"); |
36
|
|
|
|
|
|
|
} elsif ( !$opt->{print} ) { |
37
|
2
|
50
|
|
|
|
22
|
$opt->{dest} = |
38
|
|
|
|
|
|
|
File::Spec->catfile( File::HomeDir->my_home, |
39
|
|
|
|
|
|
|
( $^O eq 'MSWin32' ? '_emacs.d' : '.emacs.d' ), |
40
|
|
|
|
|
|
|
qw(editortools.el) ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
162
|
return 1; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
27
|
sub _script { File::Spec->catfile(qw(emacs editortools.el)) } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _intro { |
50
|
1
|
|
|
1
|
|
9
|
return <<"END_INTRO"; |
51
|
|
|
|
|
|
|
;;; editortools.el --- make use of App::EditorTools Perl module |
52
|
|
|
|
|
|
|
;; App::EditorTools::Command::InstallEmacs generated script |
53
|
|
|
|
|
|
|
;; Version: $VERSION |
54
|
|
|
|
|
|
|
END_INTRO |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Pod if we add the global option |
59
|
|
|
|
|
|
|
# =item --global |
60
|
|
|
|
|
|
|
# Install the script globally. This will put the script in |
61
|
|
|
|
|
|
|
# C or a similar location for your operating system. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |