1 package DX::ShellState;
3 use DX::Utils qw(deparse);
6 has template_query_state => (
7 is => 'ro', required => 1, isa => QueryState
10 has current_query_state => (
11 is => 'lazy', builder => 'new_query_state'
15 is => 'ro', required => 1,
18 has mode => (is => 'ro', required => 1);
20 sub new_query_state { $_[0]->template_query_state }
25 my ($tag, $thing) = @_;
26 my ($part) = split /\./, $tag;
27 return unless $self->trace_these->{$part};
28 my $dp = deparse($thing);
30 warn "${tag}: ${dp}\n";
34 sub with_trace_changes {
35 my ($self, @changes) = @_;
36 my %trace = %{$self->trace_these};
37 foreach my $change (@changes) {
38 if ($change =~ /^\+?(\w+)/) {
40 } elsif ($change =~ /^-(\w+)/) {
44 return $self->but(trace_these => \%trace);
47 sub with_new_query_state {
50 current_query_state => $self->new_query_state
55 my ($self, $new_mode) = @_;
57 $self->but(mode => $new_mode),
58 [ mode => $new_mode ],