use Module::Runtime qw(use_module);
use DX::Utils qw(:builders);
+{ package FakeReadline;
+ sub readline {
+ return undef unless defined(my $line = readline($_[0]));
+ print $_[1].$line;
+ return $line;
+ }
+ sub history_add {}
+}
+
use_module('DX::ShellFrontend')->new(
session_mode => 'shell',
session => use_module('DX::ShellSession')->new(
proposition_sequence
=> use_module('DX::PropositionSequence')->new_empty,
),
- )
+ ),
+ ),
+ (@ARGV
+ ? (readline => do {
+ open my $fh, '<', $ARGV[0] or die "Couldn't open script: $!";
+ bless($fh, 'FakeReadline')
+ })
+ : ()
),
)->repl