Revision 12237492
Von Sven Schöling vor mehr als 14 Jahren hinzugefügt
config/console.conf.default | ||
---|---|---|
1 |
[Console] |
|
2 |
|
|
3 |
# autologin to use if none is given |
|
4 |
login = demo |
|
5 |
|
|
6 |
# autorun lines will be executed after autologin. |
|
7 |
# be warned that loading huge libraries will noticably lengthen startup time. |
|
8 |
#autorun = use SL::Module |
|
9 |
# = use SL::Other::Module |
|
10 |
|
|
11 |
# location of history file for permanent history |
|
12 |
history_file = users/console_history |
|
13 |
|
modules/override/Devel/REPL/Plugin/AutoloadModules.pm | ||
---|---|---|
1 |
package Devel::REPL::Plugin::AutoloadModules; |
|
2 |
|
|
3 |
use Moose::Role; |
|
4 |
use namespace::clean -except => [ 'meta' ]; |
|
5 |
use Data::Dumper; |
|
6 |
|
|
7 |
has 'autoloaded' => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); |
|
8 |
|
|
9 |
my $re = qr/Runtime error: Can.t locate object method "\w+" via package "\w+" \(perhaps you forgot to load "(\w+)"\?\)/; |
|
10 |
around 'execute' => sub { |
|
11 |
my $orig = shift; |
|
12 |
my $self = shift; |
|
13 |
|
|
14 |
my @re = $self->$orig(@_); # original call |
|
15 |
|
|
16 |
return @re unless defined $re[0] && $re[0] =~ /$re/; # if there is no "perhaps you forgot" error, just return |
|
17 |
my $module = $1; # save the missing package name |
|
18 |
|
|
19 |
return @re if $self->autoloaded->{$module}; # if we tried to load it before, give up and return the error |
|
20 |
|
|
21 |
$self->autoloaded->{$module} = 1; # make sure we don't try this again |
|
22 |
$self->eval("use SL::$module"); # try to load the missing module |
|
23 |
|
|
24 |
@re = $self->$orig(@_); # try again |
|
25 |
|
|
26 |
return @re; |
|
27 |
}; |
|
28 |
|
|
29 |
1; |
modules/override/Devel/REPL/Plugin/PermanentHistory.pm | ||
---|---|---|
1 |
package Devel::REPL::Plugin::PermanentHistory; |
|
2 |
|
|
3 |
use Moose::Role; |
|
4 |
use namespace::clean -except => [ 'meta' ]; |
|
5 |
use File::Slurp; |
|
6 |
use Data::Dumper; |
|
7 |
|
|
8 |
has 'history_file' => ( is => 'rw' ); |
|
9 |
|
|
10 |
sub load_history { |
|
11 |
my $self = shift; |
|
12 |
my $file = shift; |
|
13 |
|
|
14 |
$self->history_file( $file ); |
|
15 |
|
|
16 |
return unless $self->history_file && -f $self->history_file; |
|
17 |
|
|
18 |
my @history = |
|
19 |
map { chomp; $_ } |
|
20 |
read_file($self->history_file); |
|
21 |
# print Dumper(\@history); |
|
22 |
$self->history( \@history ); |
|
23 |
$self->term->addhistory($_) for @history; |
|
24 |
} |
|
25 |
|
|
26 |
before 'DESTROY' => sub { |
|
27 |
my $self = shift; |
|
28 |
|
|
29 |
return unless $self->history_file; |
|
30 |
|
|
31 |
write_file $self->history_file, |
|
32 |
map { $_, $/ } |
|
33 |
grep $_, |
|
34 |
grep { !/^quit\b/ } |
|
35 |
@{ $self->history }; |
|
36 |
}; |
|
37 |
|
|
38 |
1; |
|
39 |
|
modules/override/Term/ReadLine/Perl/Bind.pm | ||
---|---|---|
1 |
package Term::ReadLine::Perl::Bind; |
|
2 |
### From http://www.perlmonks.org/?node_id=751611 |
|
3 |
### Posted by repellant (http://www.perlmonks.org/?node_id=665462) |
|
4 |
|
|
5 |
### Set readline bindkeys for common terminals |
|
6 |
|
|
7 |
use warnings; |
|
8 |
use strict; |
|
9 |
|
|
10 |
BEGIN { |
|
11 |
require Exporter; |
|
12 |
*import = \&Exporter::import; # just inherit import() only |
|
13 |
|
|
14 |
our $VERSION = 1.001; |
|
15 |
our @EXPORT_OK = qw(rl_bind_action $action2key $key2codes); |
|
16 |
} |
|
17 |
|
|
18 |
use Term::ReadLine; |
|
19 |
|
|
20 |
# http://cpansearch.perl.org/src/ILYAZ/Term-ReadLine-Perl-1.0302/ReadLine |
|
21 |
my $got_rl_perl; |
|
22 |
|
|
23 |
BEGIN { |
|
24 |
$got_rl_perl = eval { |
|
25 |
require Term::ReadLine::Perl; |
|
26 |
require Term::ReadLine::readline; |
|
27 |
}; |
|
28 |
} |
|
29 |
|
|
30 |
# bindkey actions for terminals |
|
31 |
our $action2key = { |
|
32 |
Complete => "Tab", |
|
33 |
PossibleCompletions => "C-d", |
|
34 |
QuotedInsert => "C-v", |
|
35 |
|
|
36 |
ToggleInsertMode => "Insert", |
|
37 |
DeleteChar => "Del", |
|
38 |
UpcaseWord => "PageUp", |
|
39 |
DownCaseWord => "PageDown", |
|
40 |
BeginningOfLine => "Home", |
|
41 |
EndOfLine => "End", |
|
42 |
|
|
43 |
ReverseSearchHistory => "C-Up", |
|
44 |
ForwardSearchHistory => "C-Down", |
|
45 |
ForwardWord => "C-Right", |
|
46 |
BackwardWord => "C-Left", |
|
47 |
|
|
48 |
HistorySearchBackward => "S-Up", |
|
49 |
HistorySearchForward => "S-Down", |
|
50 |
KillWord => "S-Right", |
|
51 |
BackwardKillWord => "S-Left", |
|
52 |
|
|
53 |
Yank => "A-Down", # paste |
|
54 |
KillLine => "A-Right", |
|
55 |
BackwardKillLine => "A-Left", |
|
56 |
}; |
|
57 |
|
|
58 |
our $key2codes = { |
|
59 |
"Tab" => [ "TAB", ], |
|
60 |
"C-d" => [ "C-d", ], |
|
61 |
"C-v" => [ "C-v", ], |
|
62 |
|
|
63 |
"Insert" => [ qq("\e[2~"), qq("\e[2z"), qq("\e[L"), ], |
|
64 |
"Del" => [ qq("\e[3~"), ], |
|
65 |
"PageUp" => [ qq("\e[5~"), qq("\e[5z"), qq("\e[I"), ], |
|
66 |
"PageDown" => [ qq("\e[6~"), qq("\e[6z"), qq("\e[G"), ], |
|
67 |
"Home" => [ qq("\e[7~"), qq("\e[1~"), qq("\e[H"), ], |
|
68 |
"End" => [ qq("\e[8~"), qq("\e[4~"), qq("\e[F"), ], |
|
69 |
|
|
70 |
"C-Up" => [ qq("\eOa"), qq("\eOA"), qq("\e[1;5A"), ], |
|
71 |
"C-Down" => [ qq("\eOb"), qq("\eOB"), qq("\e[1;5B"), ], |
|
72 |
"C-Right" => [ qq("\eOc"), qq("\eOC"), qq("\e[1;5C"), ], |
|
73 |
"C-Left" => [ qq("\eOd"), qq("\eOD"), qq("\e[1;5D"), ], |
|
74 |
|
|
75 |
"S-Up" => [ qq("\e[a"), qq("\e[1;2A"), ], |
|
76 |
"S-Down" => [ qq("\e[b"), qq("\e[1;2B"), ], |
|
77 |
"S-Right" => [ qq("\e[c"), qq("\e[1;2C"), ], |
|
78 |
"S-Left" => [ qq("\e[d"), qq("\e[1;2D"), ], |
|
79 |
|
|
80 |
"A-Down" => [ qq("\e\e[B"), qq("\e[1;3B"), ], |
|
81 |
"A-Right" => [ qq("\e\e[C"), qq("\e[1;3C"), ], |
|
82 |
"A-Left" => [ qq("\e\e[D"), qq("\e[1;3D"), ], |
|
83 |
}; |
|
84 |
|
|
85 |
# warn if any keycode is clobbered |
|
86 |
our $debug = 0; |
|
87 |
|
|
88 |
# check ref type |
|
89 |
sub _is_array { ref($_[0]) && eval { @{ $_[0] } or 1 } } |
|
90 |
sub _is_hash { ref($_[0]) && eval { %{ $_[0] } or 1 } } |
|
91 |
|
|
92 |
# set bindkey actions for each terminal |
|
93 |
my %code2action; |
|
94 |
|
|
95 |
sub rl_bind_action { |
|
96 |
if ($got_rl_perl) |
|
97 |
{ |
|
98 |
my $a2k = shift(); |
|
99 |
return () unless _is_hash($a2k); |
|
100 |
|
|
101 |
while (my ($action, $bindkey) = each %{ $a2k }) |
|
102 |
{ |
|
103 |
# use default keycodes if none provided |
|
104 |
my @keycodes = @_ ? @_ : $key2codes; |
|
105 |
|
|
106 |
for my $k2c (@keycodes) |
|
107 |
{ |
|
108 |
next unless _is_hash($k2c); |
|
109 |
|
|
110 |
my $codes = $k2c->{$bindkey}; |
|
111 |
next unless defined($codes); |
|
112 |
$codes = [ $codes ] unless _is_array($codes); |
|
113 |
|
|
114 |
for my $code (@{ $codes }) |
|
115 |
{ |
|
116 |
if ($debug && $code2action{$code}) |
|
117 |
{ |
|
118 |
my $hexcode = $code; |
|
119 |
$hexcode =~ s/^"(.*)"$/$1/; |
|
120 |
$hexcode = join(" ", map { uc } unpack("(H2)*", $hexcode)); |
|
121 |
|
|
122 |
warn <<"EOT"; |
|
123 |
rl_bind_action(): re-binding keycode [ $hexcode ] from '$code2action{$code}' to '$action' |
|
124 |
EOT |
|
125 |
} |
|
126 |
|
|
127 |
readline::rl_bind($code, $action); |
|
128 |
$code2action{$code} = $action; |
|
129 |
} |
|
130 |
} |
|
131 |
} |
|
132 |
} |
|
133 |
else |
|
134 |
{ |
|
135 |
warn <<"EOT"; |
|
136 |
rl_bind_action(): Term::ReadLine::Perl is not available. No bindkeys were set. |
|
137 |
EOT |
|
138 |
} |
|
139 |
|
|
140 |
return $got_rl_perl; |
|
141 |
} |
|
142 |
|
|
143 |
# default bind |
|
144 |
rl_bind_action($action2key); |
|
145 |
|
|
146 |
# bind Delete key for 'xterm' |
|
147 |
if ($got_rl_perl && defined($ENV{TERM}) && $ENV{TERM} =~ /xterm/) |
|
148 |
{ |
|
149 |
rl_bind_action($action2key, +{ "Del" => qq("\x7F") }); |
|
150 |
} |
|
151 |
|
|
152 |
'Term::ReadLine::Perl::Bind'; |
|
153 |
|
users/.gitignore | ||
---|---|---|
2 | 2 |
.fonts.cache* |
3 | 3 |
*_finanzamt.ini |
4 | 4 |
xvfb_display |
5 |
console_history |
Auch abrufbar als: Unified diff
Fehlende Dateien für die Konsole.