Commit | Line | Data |
9eedd677 |
1 | use strictures 2; |
2 | use Module::Runtime qw(use_module); |
fa8f5696 |
3 | use DX::Utils qw(:builders); |
9eedd677 |
4 | |
e0644ad0 |
5 | { package FakeReadline; |
6 | sub readline { |
7 | return undef unless defined(my $line = readline($_[0])); |
8 | print $_[1].$line; |
9 | return $line; |
10 | } |
11 | sub history_add {} |
12 | } |
13 | |
9eedd677 |
14 | use_module('DX::ShellFrontend')->new( |
15 | session_mode => 'shell', |
16 | session => use_module('DX::ShellSession')->new( |
17 | shell_state => use_module('DX::ShellState')->new( |
18 | mode => 'shell', |
fa8f5696 |
19 | template_query_state => use_module('DX::QueryState')->new( |
20 | predicates => { |
21 | 'eq' => use_module('DX::Predicate::Eq')->new, |
22 | member_at => use_module('DX::Predicate::MemberAt')->new, |
23 | is_dict => use_module('DX::Predicate::IsDict')->new, |
24 | }, |
25 | globals => dict(), |
26 | proposition_sequence |
27 | => use_module('DX::PropositionSequence')->new_empty, |
28 | ), |
d294025e |
29 | trace_these => {}, |
e0644ad0 |
30 | ), |
31 | ), |
32 | (@ARGV |
33 | ? (readline => do { |
34 | open my $fh, '<', $ARGV[0] or die "Couldn't open script: $!"; |
35 | bless($fh, 'FakeReadline') |
36 | }) |
37 | : () |
9eedd677 |
38 | ), |
39 | )->repl |