text stringlengths 0 834k |
|---|
} |
else { |
$o->conf('target', $targets[0]) |
unless $o->conf('target'); |
my $i = 0; |
$o->inform(""Targets:\n""); |
for (@targets) { |
$o->informf( |
""%s%2d"", |
$o->conf('target') eq $targets[$i] ? ""*"" : "" "", |
$i + 1 |
); |
$o->inform("". $_\n""); |
$i++; |
} |
} |
1; |
} |
#============================================================================ |
# Query: |
# query # displays list of previous queries |
# query <\d+> # displays results of previous query |
# query <terms> # performs a new query and displays results |
#============================================================================ |
sub smry_query { ""queries installed packages"" } |
sub help_query { <<'END' } |
query -- Query Installed Packages |
Synopsis |
query Displays list of previous queries |
query <number> Displays results of previous query |
query <glob pattern> Performs a new query using <glob pattern> |
query * Displays a list of all installed packages |
Description |
The query command displays a list of all installed packages, or a list |
based on the <glob pattern> switch. You can also check the list of past |
queries, or the results of a past query. |
With PPM 3.1, you can now perform much more powerful queries. The syntax |
is identical to the 'search' command, and almost all the search switches |
are also available for querying installed packages. |
Recall previous queries with the 'query <number>' command. PPM3 stores |
all queries from the current PPM session. |
Note: Depending on the value of the ""case-sensitivity"" setting, the |
query may or may not be case-sensitive. See ""help settings"" for |
instructions on setting the default case sensitivity. |
See Also |
search, settings |
END |
sub comp_query {()} |
sub run_query { |
my $o = shift; |
my $query = $o->raw_args || join ' ', @_; |
trace(1, ""PPM: query @_\n\tquery='$query'\n""); |
my @targets = PPM::UI::target_list()->result_l; |
my $target = $o->conf('target'); |
my $case = not $o->conf('case-sensitivity'); |
$o->warn(""You must install an installation target before using PPM.\n"") |
and return unless @targets; |
# No args: show cached query sets |
unless ($query =~ /\S/) { |
my @query_results = $o->cache_sets('query'); |
my $query_result_current = $o->cache_set_current('query'); |
if (@query_results) { |
$o->inform(""Query Result Sets:\n""); |
my $i = 0; |
for (@query_results) { |
$o->informf(""%s%2d"", |
$query_result_current == $i ? ""*"" : "" "", |
$i + 1); |
$o->inform("". $_->{query}\n""); |
$i++; |
} |
} |
else { |
$o->warn(""No query result sets -- provide a query term.\n""); |
return; |
} |
} |
# Args: |
else { |
# Show specified result set |
if ($query =~ /^\d+/) { |
my $set = int($query); |
unless (defined $o->cache_set('query', $set-1)) { |
$o->warn(""No such query result set '$set'.\n""); |
return; |
} |
$query = $o->cache_set('query', $set-1, 'query'); |
$o->inform(""Query Results Set $set ($query):\n""); |
$o->print_formatted([$o->cache_set('query', $set-1)], |
$o->cache_set_index('query')); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.