text
stringlengths
0
834k
Copyright (c) 2001 ActiveState Corp. All Rights Reserved.
ActiveState is a devision of Sophos.
Entering interactive shell.
END
my $file = PPM::Config::get_license_file();
my $license;
if (open (my $LICENSE, $file)) {
$license = do { local $/; <$LICENSE> };
}
my $aspn = $license =~ /ASPN/;
my $profile_tracking_warning = ($profile_track || !$aspn) ? '' : <<'END';
Profile tracking is not enabled. If you save and restore profiles manually,
your profile may be out of sync with your computer. See 'help profile' for
more information.
END
$o->inform($startup);
$o->inform(<<END);
Using $o->{API}{readline} as readline library.
$profile_tracking_warning
Type 'help' to get started.
END
}
else {
$o->inform(""$NAME ($VERSION). Type 'help' to get started.\n"");
}
$o->term->SetHistory(@{$o->conf('history') || []})
if $o->term->Features->{setHistory};
}
sub postloop {
my $o = shift;
trace(1, ""PPM: exiting...\n"");
if ($o->mode eq 'SHELL' and $o->term->Features->{getHistory}) {
my @h = $o->term->GetHistory;
my $max_history = $o->conf('max_history') || 100;
splice @h, 0, (@h - $max_history)
if @h > $max_history;
my $old = $o->setmode('SILENT');
$o->conf('history', \@h);
$o->setmode($old);
}
}
#============================================================================
# Cache of search and query results
#============================================================================
sub cache_set_current {
my $o = shift;
my $type = shift;
my $set = shift;
$set = $o->{SHELL}{CACHE}{$type}{current} unless defined $set;
$o->{SHELL}{CACHE}{$type}{current} = $set;
return $o->{SHELL}{CACHE}{$type}{current};
}
sub cache_set_index {
my $o = shift;
my $type = shift;
my $index = shift;
$index = $o->{SHELL}{CACHE}{$type}{index} unless defined $index;
$o->{SHELL}{CACHE}{$type}{index} = $index;
return $o->{SHELL}{CACHE}{$type}{index};
}
sub cache_set_add {
my $o = shift;
my $type = shift;
my $query = shift;
my $entries = shift;
my $sort_field = $o->conf('sort-field');
my @sorted = $o->sort_pkgs($sort_field, @$entries);
my $set = {
query => $query,
raw => $entries,
$sort_field => \@sorted,
};
push @{$o->{SHELL}{CACHE}{$type}{sets}}, $set;
}
sub cache_entry {
my $o = shift;
my $type = shift; # 'query' or 'cache';
my $index = shift; # defaults to currently selected index
my $set = shift; # defaults to currently selected set
$index = $o->{SHELL}{CACHE}{$type}{index} unless defined $index;
my $src = $o->cache_set($type, $set);
return undef unless $src and bounded(0, $index, $#$src);
# Make sure we display only valid entries:
my $tar = $o->conf('target');
$src->[$index]->make_complete($tar);
return $src->[$index];
}